Test runner unable to find test result when module path contains "py" #22120
Labels
area-testing
info-needed
Issue requires more information from poster
triage-needed
Needs assignment to the proper sub-team
Type: Bug
Behaviour
When running a pytest test via the testing feature, the extension is unable to report the results if the file path contains a "py" segment.
Expected vs. Actual
Say you are in a polyglot monorepo and you've organised your source tree by language:
When running your tests, you will get the following error message in the output:
Test result not found for <name of test>
.Renaming the directory
py
to something else, saypython
, fixes the issue.The issue seems to be due to the function that tries to strip extra ".py" file extensions from the test ID:
vscode-python/src/client/testing/testController/common/testItemUtilities.ts
Line 112 in 66c7db6
Steps to reproduce:
Using VS Code that has been configured to use pytest as the test runner.
Create a file layout similar to the one above, specifically ensuring that the test file is somewhere below the
py
directory.Add a sample test to the test file:
Diagnostic data
python.languageServer
setting: PylanceOutput for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)User Settings
Extension version: 2023.16.0
VS Code version: Code 1.82.2 (Universal) (abd2f3db4bdb28f9e95536dfa84d8479f1eb312d, 2023-09-14T05:59:47.790Z)
OS version: Darwin arm64 22.6.0
Modes:
System Info
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
A/B Experiments
The text was updated successfully, but these errors were encountered: