mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Add a profiling harness
This commit is contained in:
parent
681d56387d
commit
15b92851ed
1 changed files with 13 additions and 1 deletions
|
@ -45,4 +45,16 @@ def test_cases():
|
|||
args = argstring.split()
|
||||
assert main(args[1:]) == result_map[args[0]]
|
||||
run_test.description = 'Moveset checker test: ' + argstring.strip()
|
||||
yield run_test, argstring
|
||||
yield run_test, argstring.strip()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
filename = 'movesets.profile'
|
||||
print 'Profiling the moveset checker'
|
||||
import cProfile
|
||||
def header(str):
|
||||
print
|
||||
print str
|
||||
cProfile.runctx("[(header(arg), f(arg)) for f, arg in test_cases()]",
|
||||
globals(), locals(), filename=filename)
|
||||
print 'Profile stats saved to', filename
|
||||
|
|
Loading…
Reference in a new issue