-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pytest parameterized tests with randomly generate names #22648
Comments
Hello, it looks like you are not on the new testing rewrite. Could you enable that and try this again? It should be turned on for everyone but you might have disabled all experiments so could you check there? If not you could try adding this to your users |
Thanks for the response @eleanorjboyd . I enabled the I see that the experiment is now activated
The tests still show errors, although they seem to be different now
|
ah I see now, we have been having some issues related to running pytest parameterized tests that generate different names for each run. The extension is looking for a given name but as the random number generates a new one, the name changes and it struggles to find what test to run. Im in the process of investigating, Ill update here with the results or another issue to reference. Thanks |
Hi! Gave this some investigation. It seems right now that running parameterize tests with renamed tests is not feasible. How we handle tests is via referencing all the test items and their IDs in order to handle UI like run, the pass or fail checkmarks etc. Without a stable id we can use to reference these items, we cannot run them from our UI. If the IDs were going to be the same random number every time it would work. So for example if you generate a set of random numbers, save these as constants then use that set of numbers (which will be stable between runs) for every run it will work but right now test ids which change between runs cannot be supported. Thanks |
Type: Bug
Behaviour
Expected vs. Actual
When running pytest via VSCode, I get the following errors
But the debug window shows that it passes
And it works fine when running on command line.
Steps to reproduce:
test_bytes.py
pyproject.toml
pytest
in terminal passes.Edit: Also, when adding this test with ints, most fail the same way, but two of them seem to pass.
But the debug window still shows all tests pass, 20 this time
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.23.13471011
VS Code version: Code - Insiders 1.86.0-insider (f87fb292c3af22e51a7f5c628496cd8d6fd9ecd5, 2023-12-13T08:07:18.340Z)
OS version: Windows_NT x64 10.0.19045
Modes:
Remote OS version: Linux x64 5.15.133.1-microsoft-standard-WSL2
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
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
The text was updated successfully, but these errors were encountered: