summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2017-02-11 17:55:21 -0500
committerNed Batchelder <ned@nedbatchelder.com>2017-02-11 17:55:21 -0500
commit7875d5cbb4f8e622952e76f021c5dce2961a10e0 (patch)
tree5d4079a51deb76f5f154665868c43fdf98e33bf4
parent9aaf1fa2d6db04e9d74cefe888b9b895184d5ead (diff)
downloadpython-coveragepy-git-7875d5cbb4f8e622952e76f021c5dce2961a10e0.tar.gz
perf_measure.py is no longer a test
-rw-r--r--perf/perf_measure.py29
-rw-r--r--requirements/dev.pip2
-rw-r--r--tox.ini2
3 files changed, 21 insertions, 12 deletions
diff --git a/perf/perf_measure.py b/perf/perf_measure.py
index a41ac75c..d12d7291 100644
--- a/perf/perf_measure.py
+++ b/perf/perf_measure.py
@@ -12,10 +12,12 @@ import statistics
import sys
import time
+from unittest_mixins.mixins import make_file
+
import coverage
from coverage.backward import import_local_file
-from tests.coveragetest import CoverageTest
+from tests.helpers import SuperModuleCleaner
class StressResult(namedtuple('StressResult', ['files', 'calls', 'lines', 'baseline', 'covered'])):
@@ -44,24 +46,27 @@ def mk_main(file_count, call_count, line_count):
return "\n".join(lines)
-class StressTest(CoverageTest):
+class StressTest(object):
+
+ def __init__(self):
+ self.module_cleaner = SuperModuleCleaner()
def _run_scenario(self, file_count, call_count, line_count):
- self.clean_local_file_imports()
+ self.module_cleaner.clean_local_file_imports()
for idx in range(file_count):
- self.make_file('test{}.py'.format(idx), TEST_FILE)
- self.make_file('testmain.py', mk_main(file_count, call_count, line_count))
+ make_file('test{}.py'.format(idx), TEST_FILE)
+ make_file('testmain.py', mk_main(file_count, call_count, line_count))
# Run it once just to get the disk caches loaded up.
import_local_file("testmain")
- self.clean_local_file_imports()
+ self.module_cleaner.clean_local_file_imports()
# Run it to get the baseline time.
start = time.perf_counter()
import_local_file("testmain")
baseline = time.perf_counter() - start
- self.clean_local_file_imports()
+ self.module_cleaner.clean_local_file_imports()
# Run it to get the covered time.
start = time.perf_counter()
@@ -118,7 +123,7 @@ class StressTest(CoverageTest):
step = 50
runs = 5
- def test_count_operations(self):
+ def count_operations(self):
def operations(thing):
for runs in range(self.runs):
@@ -133,7 +138,7 @@ class StressTest(CoverageTest):
ops = sum(sum(operations(thing)) for thing in ["file", "call", "line"])
print("{0:.1f}M operations".format(ops/1e6))
- def test_coefficients(self):
+ def check_coefficients(self):
# For checking the calculation of actual stats:
data = []
for f in range(1, 6):
@@ -143,7 +148,7 @@ class StressTest(CoverageTest):
data.append("{0},{1},{2},{3[files]},{3[calls]},{3[lines]}".format(f, c, l, stats))
print("\n".join(data))
- def test_stress_test(self):
+ def stress_test(self):
# For checking the overhead for each component:
def time_thing(thing):
per_thing = []
@@ -169,3 +174,7 @@ class StressTest(CoverageTest):
time_thing("file")
time_thing("call")
time_thing("line")
+
+
+if __name__ == '__main__':
+ StressTest().stress_test()
diff --git a/requirements/dev.pip b/requirements/dev.pip
index bcbe2a35..bddc23c3 100644
--- a/requirements/dev.pip
+++ b/requirements/dev.pip
@@ -14,7 +14,7 @@ mock==2.0.0
PyContracts==1.7.15
pyenchant==1.6.8
pylint==1.6.5
-unittest-mixins==1.2
+unittest-mixins==1.2.1
# for kitting.
requests==2.12.4
diff --git a/tox.ini b/tox.ini
index d0a7ed60..ae0cface 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,7 +14,7 @@ deps =
pip==9.0.1
mock==2.0.0
PyContracts==1.7.15
- unittest-mixins==1.2
+ unittest-mixins==1.2.1
#-egit+/Users/ned/unittest_mixins#egg=unittest-mixins==0.0
py26: unittest2==1.1.0
py{27,33,34,35,36}: gevent==1.2.1