Skip to content

Commit bf48489

Browse files
committed
test: change a test to be in-process so metacov can capture its work
1 parent b0236df commit bf48489

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tests/test_process.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import coverage
2727
from coverage import env
2828
from coverage.data import line_counts
29+
from coverage.exceptions import ConfigError
2930
from coverage.files import abs_file, python_reported_file
3031

3132
from tests import testenv
@@ -1441,10 +1442,13 @@ def test_core_request_sysmon_no_branches(self) -> None:
14411442
)
14421443

14431444
def test_core_request_nosuchcore(self) -> None:
1445+
# Test the coverage misconfigurations in-process with pytest. Running a
1446+
# subprocess doesn't capture the metacov in the subprocess because
1447+
# coverage is misconfigured.
14441448
self.set_environ("COVERAGE_CORE", "nosuchcore")
1445-
out = self.run_command("coverage run numbers.py", status=1)
1446-
assert "Unknown core value: 'nosuchcore'\n" in out
1447-
assert "123 456" not in out
1449+
cov = coverage.Coverage()
1450+
with pytest.raises(ConfigError, match=r"Unknown core value: 'nosuchcore'"):
1451+
self.start_import_stop(cov, "numbers")
14481452

14491453

14501454
class FailUnderNoFilesTest(CoverageTest):

0 commit comments

Comments
 (0)