diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-27 17:35:51 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-12-27 17:52:41 -0500 |
commit | 16ef35f9be4f7b225750fac576e0f6245a100752 (patch) | |
tree | da5b7114396ed4a74b751130f3bfd12817bd24e8 /coverage/control.py | |
parent | cc989e2547fa796c84ba55b07dcf55d509c077f1 (diff) | |
download | python-coveragepy-git-16ef35f9be4f7b225750fac576e0f6245a100752.tar.gz |
Warn if two things change the dynamic context. #901
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/coverage/control.py b/coverage/control.py index 4358a541..c40508da 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -581,6 +581,10 @@ class Coverage(object): raise CoverageException( "Cannot switch context, coverage is not started" ) + + if self._collector.should_start_context: + self._warn("Conflicting dynamic contexts", slug="dynamic-conflict", once=True) + self._collector.switch_context(new_context) def clear_exclude(self, which='exclude'): |