You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:39:23 UTC
[buildstream] 09/15: tests/artifactshare: safer cleanup_on_sigterm
use
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch aevri/enable_spawn_ci_7
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 12895b62951c3c76678b0b4a21e3ca13568884e0
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Mon Oct 28 15:44:51 2019 +0000
tests/artifactshare: safer cleanup_on_sigterm use
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
---
tests/testutils/artifactshare.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py
index 7a4eda1..e49531d 100644
--- a/tests/testutils/artifactshare.py
+++ b/tests/testutils/artifactshare.py
@@ -162,11 +162,11 @@ def _start_artifact_server(queue, repodir, quota, index_only):
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(