make bench.py accept an optional script name and add a slow "manyparam" test

This commit is contained in:
holger krekel 2013-12-09 08:14:58 +01:00
parent 0d7af592c0
commit a4466342ae
2 changed files with 15 additions and 1 deletions

View File

@ -1,9 +1,11 @@
import sys
if __name__ == '__main__': if __name__ == '__main__':
import cProfile import cProfile
import py import py
import pstats import pstats
stats = cProfile.run('py.test.cmdline.main(["skip.py", ])', 'prof') script = sys.argv[1] if len(sys.argv) > 1 else "empty.py"
stats = cProfile.run('py.test.cmdline.main([%r])' % script, 'prof')
p = pstats.Stats("prof") p = pstats.Stats("prof")
p.strip_dirs() p.strip_dirs()
p.sort_stats('cumulative') p.sort_stats('cumulative')

12
bench/manyparam.py Normal file
View File

@ -0,0 +1,12 @@
import pytest
@pytest.fixture(scope='module', params=range(966))
def foo(request):
return request.param
def test_it(foo):
pass
def test_it2(foo):
pass