forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
area-testingfeature-requestRequest for new features or functionalityRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
The root cause of my observations in #24307 (which still deserves its own solution IMHO) is coveragepy/coveragepy#1392. Unfortunately, configuring omit alone does not help because this code snipped does not consider it:
vscode-python/python_files/vscode_pytest/__init__.py
Lines 432 to 448 in e8dd8c0
| # load the report and build the json result to return | |
| import coverage | |
| cov = coverage.Coverage() | |
| cov.load() | |
| file_set: set[str] = cov.get_data().measured_files() | |
| file_coverage_map: dict[str, FileCoverageInfo] = {} | |
| for file in file_set: | |
| analysis = cov.analysis2(file) | |
| lines_executable = {int(line_no) for line_no in analysis[1]} | |
| lines_missed = {int(line_no) for line_no in analysis[3]} | |
| lines_covered = lines_executable - lines_missed | |
| file_info: FileCoverageInfo = { | |
| "lines_covered": list(lines_covered), # list of int | |
| "lines_missed": list(lines_missed), # list of int | |
| } | |
| file_coverage_map[file] = file_info |
cov._check_include_omit_etc being private, the extension cannot really know what to check. So I propose replacing
| analysis = cov.analysis2(file) |
by
try:
analysis = cov.analysis2(file)
except NoSource:
continueMetadata
Metadata
Assignees
Labels
area-testingfeature-requestRequest for new features or functionalityRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team