summaryrefslogtreecommitdiff
path: root/tests/test_process.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-02-06 13:10:21 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-02-07 17:24:44 -0500
commit5dbf7010ad9f88019b1b3a7e47aa05278ee00e30 (patch)
tree27043e6adb379b6d7ba42d3d64e1cc726568884c /tests/test_process.py
parenta9b259732e6cc96afd29c902670a0d4c9177714e (diff)
downloadpython-coveragepy-git-5dbf7010ad9f88019b1b3a7e47aa05278ee00e30.tar.gz
test: more-uniform skipping of test during metacov
Diffstat (limited to 'tests/test_process.py')
-rw-r--r--tests/test_process.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/tests/test_process.py b/tests/test_process.py
index 536199db..14e7213c 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -618,10 +618,9 @@ class ProcessTest(CoverageTest):
assert "warning" not in out
assert "Exception" not in out
+ @pytest.mark.skipif(env.METACOV, reason="Can't test tracers changing during metacoverage")
def test_warnings_trace_function_changed_with_threads(self):
# https://github.com/nedbat/coveragepy/issues/164
- if env.METACOV:
- self.skipTest("Can't test tracers changing during metacoverage")
self.make_file("bug164.py", """\
import threading
@@ -653,6 +652,9 @@ class ProcessTest(CoverageTest):
assert "Trace function changed" in out
+ # When meta-coverage testing, this test doesn't work, because it finds
+ # coverage.py's own trace function.
+ @pytest.mark.skipif(env.METACOV, reason="Can't test timid during coverage measurement.")
def test_timid(self):
# Test that the --timid command line argument properly swaps the tracer
# function for a simpler one.
@@ -663,11 +665,6 @@ class ProcessTest(CoverageTest):
# an environment variable set in igor.py to know whether to expect to see
# the C trace function or not.
- # When meta-coverage testing, this test doesn't work, because it finds
- # coverage.py's own trace function.
- if os.environ.get('COVERAGE_COVERAGE', ''):
- self.skipTest("Can't test timid during coverage measurement.")
-
self.make_file("showtrace.py", """\
# Show the current frame's trace function, so that we can test what the
# command-line options do to the trace function used.
@@ -737,11 +734,12 @@ class ProcessTest(CoverageTest):
assert msg in out
@pytest.mark.expensive
- def test_fullcoverage(self): # pragma: no metacov
+ @pytest.mark.skipif(env.METACOV, reason="Can't test fullcoverage when measuring ourselves")
+ def test_fullcoverage(self):
if env.PY2: # This doesn't work on Python 2.
self.skipTest("fullcoverage doesn't work on Python 2.")
- # It only works with the C tracer, and if we aren't measuring ourselves.
- if not env.C_TRACER or env.METACOV:
+ # It only works with the C tracer.
+ if not env.C_TRACER:
self.skipTest("fullcoverage only works with the C tracer.")
# fullcoverage is a trick to get stdlib modules measured from
@@ -1482,6 +1480,7 @@ class ProcessCoverageMixin(object):
self.addCleanup(persistent_remove, self.pth_path)
+@pytest.mark.skipif(env.METACOV, reason="Can't test sub-process pth file during metacoverage")
class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
"""Test that we can measure coverage in sub-processes."""
@@ -1501,10 +1500,7 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
f.close()
""")
- def test_subprocess_with_pth_files(self): # pragma: no metacov
- if env.METACOV:
- self.skipTest("Can't test sub-process pth file suppport during metacoverage")
-
+ def test_subprocess_with_pth_files(self):
# An existing data file should not be read when a subprocess gets
# measured automatically. Create the data file here with bogus data in
# it.
@@ -1528,11 +1524,8 @@ class ProcessStartupTest(ProcessCoverageMixin, CoverageTest):
data.read()
assert line_counts(data)['sub.py'] == 3
- def test_subprocess_with_pth_files_and_parallel(self): # pragma: no metacov
+ def test_subprocess_with_pth_files_and_parallel(self):
# https://github.com/nedbat/coveragepy/issues/492
- if env.METACOV:
- self.skipTest("Can't test sub-process pth file suppport during metacoverage")
-
self.make_file("coverage.ini", """\
[run]
parallel = true
@@ -1575,9 +1568,10 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
"""
+ @pytest.mark.skipif(env.METACOV, reason="Can't test sub-process pth file during metacoverage")
def assert_pth_and_source_work_together(
self, dashm, package, source
- ): # pragma: no metacov
+ ):
"""Run the test for a particular combination of factors.
The arguments are all strings:
@@ -1592,9 +1586,6 @@ class ProcessStartupWithSourceTest(ProcessCoverageMixin, CoverageTest):
``--source`` argument.
"""
- if env.METACOV:
- self.skipTest("Can't test sub-process pth file support during metacoverage")
-
def fullname(modname):
"""What is the full module name for `modname` for this test?"""
if package and dashm: