summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2019-10-28 15:44:51 +0000
committerbst-marge-bot <marge-bot@buildstream.build>2019-11-05 09:57:43 +0000
commitd938b0cd629870155a7de7bb56baae3c2306b6ab (patch)
tree024f99eadbab29175c2b0b66cbcb1a738fd1243e
parent4ec1b734357a7e69beef2177ec072bd1aef629d0 (diff)
downloadbuildstream-d938b0cd629870155a7de7bb56baae3c2306b6ab.tar.gz
tests/artifactshare: safer cleanup_on_sigterm useaevri/testutils_artifactshare
Use the documented path [1] to `pytest_cov.embed.cleanup_on_sigterm()`, to avoid crashing on some versions. It turns out that pytest_cov v2.6.1 on my machine doesn't like the way that we were accessing cleanup_on_sigterm(). Access it in such a way that we will either get the function or an ImportError, as per the documentation. [1]: https://pytest-cov.readthedocs.io/en/latest/subprocess-support.html
-rw-r--r--tests/testutils/artifactshare.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index e5434b63f..18ecc5e3e 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -74,11 +74,11 @@ class ArtifactShare():
signal.signal(signal.SIGTERM, lambda signalnum, frame: sys.exit(0))
try:
- import pytest_cov
+ from pytest_cov.embed import cleanup_on_sigterm
except ImportError:
pass
else:
- pytest_cov.embed.cleanup_on_sigterm()
+ cleanup_on_sigterm()
server = stack.enter_context(
create_server(