summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2018-01-17 04:31:47 (GMT)
committerDaniel Moody <dmoody256@gmail.com>2018-01-17 04:31:47 (GMT)
commit74080a2f9ce5595a7fb9d88433cec9c83c99969c (patch)
tree3c709cd9e1ed3e0e0fd9e0ef6ed4ae8ffb35bd97
parenta90dd653a51ac7be36122a456b3667fe45d30154 (diff)
downloadSCons-74080a2f9ce5595a7fb9d88433cec9c83c99969c.zip
SCons-74080a2f9ce5595a7fb9d88433cec9c83c99969c.tar.gz
SCons-74080a2f9ce5595a7fb9d88433cec9c83c99969c.tar.bz2
moved coverage check for tests to common location.
-rw-r--r--QMTest/TestSCons.py5
-rw-r--r--test/Repository/M4.py2
-rw-r--r--test/exitfns.py2
3 files changed, 7 insertions, 2 deletions
diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py
index f0d25cb..ef907d8 100644
--- a/QMTest/TestSCons.py
+++ b/QMTest/TestSCons.py
@@ -1036,6 +1036,11 @@ SConscript( sconscript )
# to use cygwin compilers on cmd.exe -> uncomment following line
#Configure_lib = 'm'
+ def coverage_run(self):
+ """ Check if the the tests are being run under coverage.
+ """
+ return 'COVERAGE_PROCESS_START' in os.environ or 'COVERAGE_FILE' in os.environ
+
def skip_if_not_msvc(self, check_platform=True):
""" Check whether we are on a Windows platform and skip the
test if not. This check can be omitted by setting
diff --git a/test/Repository/M4.py b/test/Repository/M4.py
index 29647e9..8fa91ab 100644
--- a/test/Repository/M4.py
+++ b/test/Repository/M4.py
@@ -37,7 +37,7 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
# TODO: figure out how to write the coverage data to the locked folder or maybe somewhere else
-if 'COVERAGE_PROCESS_START' in os.environ:
+if test.coverage_run():
test.skip_test("this test locks the folder for writing meaning coverage data can not be written; skipping test.")
test.subdir('work', 'repository', ['repository', 'src'])
diff --git a/test/exitfns.py b/test/exitfns.py
index c0da861..fca44b8 100644
--- a/test/exitfns.py
+++ b/test/exitfns.py
@@ -31,7 +31,7 @@ test = TestSCons.TestSCons()
# also exclude these tests since it overides the exit function which doesnt work with coverage
# # more info here: https://coverage.readthedocs.io/en/coverage-4.4.2/subprocess.html#
# TODO: figure out how to cover tests which use exit functions
-if 'COVERAGE_PROCESS_START' in os.environ:
+if test.coverage_run():
test.skip_test("This test replaces the exit function which is needed by coverage to write test data; skipping test.")
sconstruct = """