File tree 1 file changed +7
-1
lines changed
python_files/vscode_pytest
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):
442
442
if is_coverage_run == "True" :
443
443
# load the report and build the json result to return
444
444
import coverage
445
+ from coverage .exceptions import NoSource
445
446
446
447
cov = coverage .Coverage ()
447
448
cov .load ()
449
+
448
450
file_set : set [str ] = cov .get_data ().measured_files ()
449
451
file_coverage_map : dict [str , FileCoverageInfo ] = {}
450
452
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
452
458
lines_executable = {int (line_no ) for line_no in analysis [1 ]}
453
459
lines_missed = {int (line_no ) for line_no in analysis [3 ]}
454
460
lines_covered = lines_executable - lines_missed
You can’t perform that action at this time.
0 commit comments