Skip to content

Commit

Permalink
Add trinket tests.
Browse files Browse the repository at this point in the history
Use argparse for run.py since I was not happy with the silent fail when invoking it without arguments.

simc-support is a helper library written by Bloodmallet which contains various game data as json and is easily accessible with python. It is a outside dependency, but I thought it was worth the effort. Can be disabled with --no-trinkets option.
  • Loading branch information
scamille committed Oct 8, 2020
1 parent 92926ba commit af17308
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ jobs:
profiles
tests
key: ubuntu-clang-10-for_run-${{ github.sha }}

- name: Install Python dependencies
run: pip install -r tests/requirements.txt

- name: Run
env:
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
simc-support
24 changes: 21 additions & 3 deletions tests/run.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
#!/usr/bin/env python3

import sys
import argparse

from helper import Test, TestGroup, run, find_profiles
from talent_options import talent_combinations

FIGHT_STYLES = ( 'Patchwerk', 'DungeonSlice', 'HeavyMovement' )
COVENANTS = ( 'Kyrian', 'Venthyr', 'Night_Fae', 'Necrolord' )

if len(sys.argv) < 2:
sys.exit(1)
parser = argparse.ArgumentParser(description='Run simc tests')
parser.add_argument('specialization', metavar='spec', type=str,
help='Simc specialization in the form of CLASS_SPEC, eg. Priest_Shadow')
parser.add_argument('--no-trinkets', default=False,action="store_true",
help='Disable trinket tests. Requires simc-support dependency to be installed')
args = parser.parse_args()

klass = sys.argv[1]
klass = args.specialization

print(' '.join(klass.split('_')))

Expand All @@ -31,5 +36,18 @@
for covenant in COVENANTS:
Test(covenant, group=grp,
args=[ ('covenant', covenant.lower()), ('level', 60) ])

if not args.no_trinkets:
from simc_support.game_data.WowSpec import get_wow_spec
from simc_support.game_data.Trinket import get_trinkets_for_spec

wow_class, wow_spec = klass.split('_')
trinkets = get_trinkets_for_spec(get_wow_spec(wow_class, wow_spec))
for fight_style in FIGHT_STYLES:
grp = TestGroup('{}/{}/trinkets'.format(profile, fight_style),
fight_style=fight_style, profile=path)
tests.append(grp)
for trinket in trinkets:
Test('{} ({})'.format(trinket.name, trinket.item_id), group=grp, args=[ ('trinket1', '{},id={},ilevel={}'.format(trinket.name, trinket.item_id, trinket.min_itemlevel)) ])

sys.exit( run(tests) )

0 comments on commit af17308

Please sign in to comment.