File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 2626import coverage
2727from coverage import env
2828from coverage .data import line_counts
29+ from coverage .exceptions import ConfigError
2930from coverage .files import abs_file , python_reported_file
3031
3132from 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
14501454class FailUnderNoFilesTest (CoverageTest ):
You can’t perform that action at this time.
0 commit comments