File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
python_files/vscode_pytest Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -442,13 +442,19 @@ def pytest_sessionfinish(session, exitstatus):
442442 if is_coverage_run == "True" :
443443 # load the report and build the json result to return
444444 import coverage
445+ from coverage .exceptions import NoSource
445446
446447 cov = coverage .Coverage ()
447448 cov .load ()
449+
448450 file_set : set [str ] = cov .get_data ().measured_files ()
449451 file_coverage_map : dict [str , FileCoverageInfo ] = {}
450452 for file in file_set :
451- analysis = cov .analysis2 (file )
453+ try :
454+ analysis = cov .analysis2 (file )
455+ except NoSource :
456+ # as per issue 24308 this best way to handle this edge case
457+ continue
452458 lines_executable = {int (line_no ) for line_no in analysis [1 ]}
453459 lines_missed = {int (line_no ) for line_no in analysis [3 ]}
454460 lines_covered = lines_executable - lines_missed
You can’t perform that action at this time.
0 commit comments