diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-03-05 12:47:02 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2019-03-05 12:54:51 +0900 |
commit | d093671fc806898a6c194767b4f33a50f7681ab5 (patch) | |
tree | 6084d20cbee18e13f7715d4adaabd97a2b68430c | |
parent | 79bbefe26a3fcd13d3de558aed6b5b4d5bc1235a (diff) | |
download | buildstream-d093671fc806898a6c194767b4f33a50f7681ab5.tar.gz |
tests/testutils/artifactshare.py: Support optional coverage
This scaffolding needs to manually tell coverage to cleanup
when sigterm happens in the process in order to collect
the coverage report, but we need to do this conditionally
in case we are running tests without coverage support.
-rw-r--r-- | tests/testutils/artifactshare.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/testutils/artifactshare.py b/tests/testutils/artifactshare.py index 85fdcf30b..1e417c592 100644 --- a/tests/testutils/artifactshare.py +++ b/tests/testutils/artifactshare.py @@ -8,7 +8,6 @@ from collections import namedtuple from contextlib import contextmanager from multiprocessing import Process, Queue -import pytest_cov from buildstream import _yaml from buildstream._artifactcache.cascache import CASCache @@ -75,7 +74,13 @@ class ArtifactShare(): # Run the artifact server. # def run(self, q): - pytest_cov.embed.cleanup_on_sigterm() + + try: + import pytest_cov + except ImportError: + pass + else: + pytest_cov.embed.cleanup_on_sigterm() # Optionally mock statvfs if self.total_space: |