From a4466342aede289875fbd0bbb40b510705887847 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 9 Dec 2013 08:14:58 +0100 Subject: [PATCH] make bench.py accept an optional script name and add a slow "manyparam" test --- bench/bench.py | 4 +++- bench/manyparam.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 bench/manyparam.py diff --git a/bench/bench.py b/bench/bench.py index ce934feb9..6e9d710ba 100644 --- a/bench/bench.py +++ b/bench/bench.py @@ -1,9 +1,11 @@ +import sys if __name__ == '__main__': import cProfile import py 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.strip_dirs() p.sort_stats('cumulative') diff --git a/bench/manyparam.py b/bench/manyparam.py new file mode 100644 index 000000000..d2bca0e8a --- /dev/null +++ b/bench/manyparam.py @@ -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 +