summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-05-08 14:23:17 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-05-08 14:23:17 -0400
commitd7397a71324bcec6f12773f1d6deac3ab64e64e4 (patch)
tree5f43d35ea84afb183fe63497f339a121fc8ec216 /coverage/control.py
parente24f7b0afdc1895c888d6120476b334221d54ecc (diff)
downloadpython-coveragepy-d7397a71324bcec6f12773f1d6deac3ab64e64e4.tar.gz
Return the Coverage instance from process_startup
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py
index e15b5a4..3e18074 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -1166,11 +1166,14 @@ def process_startup():
import coverage; coverage.process_startup()
+ Returns the :class:`Coverage` instance that was started, or None if it was
+ not started by this call.
+
"""
cps = os.environ.get("COVERAGE_PROCESS_START")
if not cps:
# No request for coverage, nothing to do.
- return
+ return None
# This function can be called more than once in a process. This happens
# because some virtualenv configurations make the same directory visible
@@ -1185,10 +1188,12 @@ def process_startup():
if hasattr(process_startup, "done"):
# We've annotated this function before, so we must have already
# started coverage.py in this process. Nothing to do.
- return
+ return None
process_startup.done = True
cov = Coverage(config_file=cps, auto_data=True)
cov.start()
cov._warn_no_data = False
cov._warn_unimported_source = False
+
+ return cov