summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2009-08-09 18:12:23 -0400
committerNed Batchelder <ned@nedbatchelder.com>2009-08-09 18:12:23 -0400
commitcba5899f0bad8a49b17750df58ddd532975c1062 (patch)
tree02eac123c89f439b440c7efb6a7aa0a98bd12e80 /coverage/control.py
parentb159081bb7df0c838bcf01ca9e70899a61ae9d9b (diff)
downloadpython-coveragepy-git-cba5899f0bad8a49b17750df58ddd532975c1062.tar.gz
Fix a problem with DecoratorTools fiddling with the trace function and screwing us up. Now the Python trace function is simpler, with no variability of registered trace function. Fixes bugs #12 and #13.
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/coverage/control.py b/coverage/control.py
index 57079fee..2cfde279 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -20,13 +20,14 @@ class coverage:
cov = coverage()
cov.start()
- #.. blah blah (run your code) blah blah
+ #.. blah blah (run your code) blah blah ..
cov.stop()
cov.html_report(directory='covhtml')
"""
+
def __init__(self, data_file=None, data_suffix=False, cover_pylib=False,
- auto_data=False):
+ auto_data=False, timid=False):
"""Create a new coverage measurement context.
`data_file` is the base name of the data file to use, defaulting to
@@ -42,6 +43,11 @@ class coverage:
coverage measurement starts, and data will be saved automatically when
measurement stops.
+ If `timid` is true, then a slower simpler trace function will be
+ used. This is important for some environments where manipulation of
+ tracing functions make the faster more sophisticated trace function not
+ operate properly.
+
"""
from coverage import __version__
@@ -53,7 +59,11 @@ class coverage:
self.file_locator = FileLocator()
- self.collector = Collector(self._should_trace)
+ # Timidity: for nose users, read an environment variable. This is a
+ # cheap hack, since the rest of the command line arguments aren't
+ # recognized, but it solves some users' problems.
+ timid = timid or ('--timid' in os.environ.get('COVERAGE_OPTIONS', ''))
+ self.collector = Collector(self._should_trace, timid=timid)
# Create the data file.
if data_suffix: