summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorholger krekel <holger@merlinux.eu>2010-11-18 15:19:20 +0100
committerholger krekel <holger@merlinux.eu>2010-11-18 15:19:20 +0100
commit5a2295ada518fbfb597f07c76d773385cc46171e (patch)
tree59ac77ac071323e358bbcabb006443eec41fdf78 /bench
parent03254410991b2c623bd98a99ad297cb6f28d7209 (diff)
downloadpytest-5a2295ada518fbfb597f07c76d773385cc46171e.tar.gz
fix bare "py.test" runs without a directory by not defaulting to --doctest-modules which will virtually import everything
Diffstat (limited to 'bench')
-rw-r--r--bench/bench.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/bench/bench.py b/bench/bench.py
index 2baa92440..0a356a990 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -1,9 +1,10 @@
-import cProfile
-import py
-import pstats
-stats = cProfile.run('py.test.cmdline.main(["empty.py", ])', 'prof')
-p = pstats.Stats("prof")
-p.strip_dirs()
-p.sort_stats('cumulative')
-print p.print_stats(30)
+if __name__ == '__main__':
+ import cProfile
+ import py
+ import pstats
+ stats = cProfile.run('py.test.cmdline.main(["empty.py", ])', 'prof')
+ p = pstats.Stats("prof")
+ p.strip_dirs()
+ p.sort_stats('cumulative')
+ print p.print_stats(30)