diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-05-08 14:23:17 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-05-08 14:23:17 -0400 |
commit | 59e6ad6ccf9cb36eedd0417add05115785b00aad (patch) | |
tree | 3ad0e71e1ebcb26f4575f12b36eacd2aa7fb773a /coverage/control.py | |
parent | 6cb166021535eee3e57124ac6667d8ce2a73118f (diff) | |
download | python-coveragepy-git-59e6ad6ccf9cb36eedd0417add05115785b00aad.tar.gz |
Return the Coverage instance from process_startup
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py index e15b5a40..3e180745 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 |