diff options
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | coverage/control.py | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index a6f0efa4..ff04775b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -46,6 +46,9 @@ Unreleased functions, but now at least we raise a more specific error message, rather than getting confused. (`issue 456`_) +- The `coverage.process_startup` function now returns the `Coverage` instance + it creates, as suggested in `issue 481`_. + - Make a small tweak to how we compare threads, to avoid buggy custom comparison code in thread classes. (`issue 245`_) @@ -58,6 +61,7 @@ Unreleased .. _issue 472: https://bitbucket.org/ned/coveragepy/issues/472/html-report-indents-incorrectly-for-one .. _issue 475: https://bitbucket.org/ned/coveragepy/issues/475/generator-expression-is-marked-as-not .. _issue 479: https://bitbucket.org/ned/coveragepy/issues/479/clarify-the-need-for-the-c-extension +.. _issue 481: https://bitbucket.org/ned/coveragepy/issues/481/asyncioprocesspoolexecutor-tracing-not Version 4.1b2 --- 2016-01-23 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 |