Closed cquick01 closed 10 months ago
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 settings.json
"python.experiments.optInto": ["pythonTestAdapter"]
. You can check if its enabled by looking at Experiment 'pythonTestAdapter'
is active in your python logs. If you are unable to see the log for the experiment change your log level to info or trace and it should show up (can be done via the command palette). Thanks!
Thanks for the response @eleanorjboyd . I enabled the pythonTestAdapter
experiment but am still running into issues running the tests.
I see that the experiment is now activated
2023-12-15 09:48:03.524 [info] Telemetry level is off
2023-12-15 09:48:03.524 [info] Experiments are disabled, only manually opted experiments are active.
2023-12-15 09:48:03.524 [info] Experiment 'pythonTestAdapter' is active
2023-12-15 09:48:03.722 [info] Default formatter is set to null for workspace /home/user/test
2023-12-15 09:48:04.805 [info] Test server listening.
2023-12-15 09:48:05.027 [info] > ~/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 -I ~/.vscode-server-insiders/extensions/ms-python.python-2023.23.13481009/pythonFiles/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2023.23.13481009/pythonFiles/interpreterInfo.py
2023-12-15 09:48:05.667 [info] Python interpreter path: ~/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3
2023-12-15 09:48:05.968 [info] > conda info --json
2023-12-15 09:48:06.339 [info] > . ~/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server-insiders/extensions/ms-python.python-2023.23.13481009/pythonFiles/printEnvVariables.py
2023-12-15 09:48:06.339 [info] shell: bash
2023-12-15 09:48:07.403 [info] Starting Pylance language server.
The tests still show errors, although they seem to be different now
CLIENT: Server listening on port 41559...
Received JSON data in run script
Running pytest with args: ['-p', 'vscode_pytest', '--rootdir', '/home/user/test', '/home/user/test/tests/test_bytes.py::test_randints[17]', '/home/user/test/tests/test_bytes.py::test_randints[46]', '/home/user/test/tests/test_bytes.py::test_randints[6]', '/home/user/test/tests/test_bytes.py::test_randints[18]', '/home/user/test/tests/test_bytes.py::test_randints[0]', '/home/user/test/tests/test_bytes.py::test_randints[48]', '/home/user/test/tests/test_bytes.py::test_randints[14]', '/home/user/test/tests/test_bytes.py::test_randints[60]', '/home/user/test/tests/test_bytes.py::test_randints[39]', '/home/user/test/tests/test_bytes.py::test_randints[64]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\x80\\xde}=\\x8c2/7\\x00Y\\x10`\\x0b\\xce%\\xfd\\xbd\\xd0_\\xee\\x11\\xe8rW\\x8c\\xb9\\xf0N\\xa11<f\\xc9u\\xb3\\x92\\x18\\x0c\\xeb\\x99\\x136?\\x13\\xc7\\xda\\xbe\\xee\\xc1t\\x87\\xeaE\\xa7\\xebk\\x14\\x86\\xcdv]', '/home/user/test/tests/test_bytes.py::test_randbytes[c\\xd9\\xd9\\x98|e`V\\xc3\\xce\\x04N\\xfc*\\xfc)o\\xb5\\xa6\\xe6\\xedJ\\x0eo\\x94\\xea\\x17\\xef]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\x9b\\xe4\\xf63yd\\xe1)\\x02\\x87\\x17\\xd3\\xc4\\xc7M\\xacc\\xab\\x1cdJ\\xca\\x04\\\\x81\\n\\xca.\\xe7\\x9f\\x13\\xfd\\xe3\\x86\\xa2c\\xe2\\xfe\\xaf]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\x05\\xd5\\xed\\x12\\xa4!e\\xaf\\x16$\\xfb"<\\x91\\xce\\xd9\\xb9\\xdb`\\xbe\\xfd:\\xf0\\xd8/,\\x84\\xbdC\\xf7\\xdd\\x0c\\x94?\\xe4\\xe0\\xbe]\\xa2\\xb53\\xf6\\xb80\\x93\\xfd\\xbabC\\xfc\\xba\\xe5s<\\x00d]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\xb8\\x0e\\xfcs\\xa2]\\xfe\\xb2\\xbe\\x06\\xd4\\x83\\x8e\\x9a\\xc1\\xee\\xd7K\\nL=^\\xb6\\x99\\xce1N\\xf5\\x06\\x9f\\xebM\\xf0\\xfb\\x9c\\xc0\\x81\\x04i\\x10\\x7f\\xa9]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\x92k\\x11\\x1c\\xb0m\\x89\\x16j\\x02"\\xf3\\xf2\\xc9\\xcb\\x9aG]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\xec"\\nZ\\xbc\\xd5T\\xb1\\xeczX\\xd1\\xee]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\xe2\\xa4\\x84&\\xb2[Hk\\xc67\\xaf\\x13\\x96\\x18\\xa6\\xbd\\x0bC\\x1cS\\xd1\\xde\\x9e\\xfeJ\\x87,\\x00L\\xefr\\xc3\\xfb-\\x81\\xdb\\xf9\\xc5]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\xdf\\xab)u\\x14\\xe2\\x8d\\xe0\\xd8\\x13\\xb5\\xddn\\xe9\\xe3K\\xf0E\\xb1]', '/home/user/test/tests/test_bytes.py::test_randbytes[\\x00i\\xb2\\x08\\x86\\x99\\x98"\\x1bw<\\xf4\\x84[\\xc4\\xb9\\x81\\x9f\\x00q\\xaes\\xce\\xfd\\xb4^\\xbe\\x12\\x8e\\xdcv\\xff|\\x06\\x9d\\x97]']
============================= test session starts ==============================
platform linux -- Python 3.11.3, pytest-7.4.3, pluggy-1.3.0
rootdir: /home/user/test
collected 2 items
============================ no tests ran in 0.01s =============================
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[17]
(no name '/home/user/test/tests/test_bytes.py::test_randints[17]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[46]
(no name '/home/user/test/tests/test_bytes.py::test_randints[46]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[6]
(no name '/home/user/test/tests/test_bytes.py::test_randints[6]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[0]
(no name '/home/user/test/tests/test_bytes.py::test_randints[0]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[48]
(no name '/home/user/test/tests/test_bytes.py::test_randints[48]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[14]
(no name '/home/user/test/tests/test_bytes.py::test_randints[14]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[60]
(no name '/home/user/test/tests/test_bytes.py::test_randints[60]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randints[64]
(no name '/home/user/test/tests/test_bytes.py::test_randints[64]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\x80\xde}=\x8c2/7\x00Y\x10`\x0b\xce%\xfd\xbd\xd0_\xee\x11\xe8rW\x8c\xb9\xf0N\xa11<f\xc9u\xb3\x92\x18\x0c\xeb\x99\x136?\x13\xc7\xda\xbe\xee\xc1t\x87\xeaE\xa7\xebk\x14\x86\xcdv]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\x80\\xde}=\\x8c2/7\\x00Y\\x10`\\x0b\\xce%\\xfd\\xbd\\xd0_\\xee\\x11\\xe8rW\\x8c\\xb9\\xf0N\\xa11<f\\xc9u\\xb3\\x92\\x18\\x0c\\xeb\\x99\\x136?\\x13\\xc7\\xda\\xbe\\xee\\xc1t\\x87\\xeaE\\xa7\\xebk\\x14\\x86\\xcdv]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[c\xd9\xd9\x98|e`V\xc3\xce\x04N\xfc*\xfc)o\xb5\xa6\xe6\xedJ\x0eo\x94\xea\x17\xef]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[c\\xd9\\xd9\\x98|e`V\\xc3\\xce\\x04N\\xfc*\\xfc)o\\xb5\\xa6\\xe6\\xedJ\\x0eo\\x94\\xea\\x17\\xef]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\x9b\xe4\xf63yd\xe1)\x02\x87\x17\xd3\xc4\xc7M\xacc\xab\x1cdJ\xca\x04\\x81\n\xca.\xe7\x9f\x13\xfd\xe3\x86\xa2c\xe2\xfe\xaf]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\x9b\\xe4\\xf63yd\\xe1)\\x02\\x87\\x17\\xd3\\xc4\\xc7M\\xacc\\xab\\x1cdJ\\xca\\x04\\\\x81\\n\\xca.\\xe7\\x9f\\x13\\xfd\\xe3\\x86\\xa2c\\xe2\\xfe\\xaf]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\x05\xd5\xed\x12\xa4!e\xaf\x16$\xfb"<\x91\xce\xd9\xb9\xdb`\xbe\xfd:\xf0\xd8/,\x84\xbdC\xf7\xdd\x0c\x94?\xe4\xe0\xbe]\xa2\xb53\xf6\xb80\x93\xfd\xbabC\xfc\xba\xe5s<\x00d]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\x05\\xd5\\xed\\x12\\xa4!e\\xaf\\x16$\\xfb"<\\x91\\xce\\xd9\\xb9\\xdb`\\xbe\\xfd:\\xf0\\xd8/,\\x84\\xbdC\\xf7\\xdd\\x0c\\x94?\\xe4\\xe0\\xbe]\\xa2\\xb53\\xf6\\xb80\\x93\\xfd\\xbabC\\xfc\\xba\\xe5s<\\x00d]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\xb8\x0e\xfcs\xa2]\xfe\xb2\xbe\x06\xd4\x83\x8e\x9a\xc1\xee\xd7K\nL=^\xb6\x99\xce1N\xf5\x06\x9f\xebM\xf0\xfb\x9c\xc0\x81\x04i\x10\x7f\xa9]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\xb8\\x0e\\xfcs\\xa2]\\xfe\\xb2\\xbe\\x06\\xd4\\x83\\x8e\\x9a\\xc1\\xee\\xd7K\\nL=^\\xb6\\x99\\xce1N\\xf5\\x06\\x9f\\xebM\\xf0\\xfb\\x9c\\xc0\\x81\\x04i\\x10\\x7f\\xa9]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\x92k\x11\x1c\xb0m\x89\x16j\x02"\xf3\xf2\xc9\xcb\x9aG]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\x92k\\x11\\x1c\\xb0m\\x89\\x16j\\x02"\\xf3\\xf2\\xc9\\xcb\\x9aG]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\xec"\nZ\xbc\xd5T\xb1\xeczX\xd1\xee]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\xec"\\nZ\\xbc\\xd5T\\xb1\\xeczX\\xd1\\xee]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\xe2\xa4\x84&\xb2[Hk\xc67\xaf\x13\x96\x18\xa6\xbd\x0bC\x1cS\xd1\xde\x9e\xfeJ\x87,\x00L\xefr\xc3\xfb-\x81\xdb\xf9\xc5]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\xe2\\xa4\\x84&\\xb2[Hk\\xc67\\xaf\\x13\\x96\\x18\\xa6\\xbd\\x0bC\\x1cS\\xd1\\xde\\x9e\\xfeJ\\x87,\\x00L\\xefr\\xc3\\xfb-\\x81\\xdb\\xf9\\xc5]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\xdf\xab)u\x14\xe2\x8d\xe0\xd8\x13\xb5\xddn\xe9\xe3K\xf0E\xb1]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\xdf\\xab)u\\x14\\xe2\\x8d\\xe0\\xd8\\x13\\xb5\\xddn\\xe9\\xe3K\\xf0E\\xb1]' in any of [<Module tests/test_bytes.py>])
ERROR: not found: /home/user/test/tests/test_bytes.py::test_randbytes[\x00i\xb2\x08\x86\x99\x98"\x1bw<\xf4\x84[\xc4\xb9\x81\x9f\x00q\xaes\xce\xfd\xb4^\xbe\x12\x8e\xdcv\xff|\x06\x9d\x97]
(no name '/home/user/test/tests/test_bytes.py::test_randbytes[\\x00i\\xb2\\x08\\x86\\x99\\x98"\\x1bw<\\xf4\\x84[\\xc4\\xb9\\x81\\x9f\\x00q\\xaes\\xce\\xfd\\xb4^\\xbe\\x12\\x8e\\xdcv\\xff|\\x06\\x9d\\x97]' in any of [<Module tests/test_bytes.py>])
Finished running tests!
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
)``` 2023-12-13 17:19:53.199 [debug] Clearing context for python dependencies not installed: /home/user/test/pyproject.toml 2023-12-13 17:19:53.202 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 2023-12-13 17:19:53.202 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 2023-12-13 17:19:53.219 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 2023-12-13 17:19:53.234 [info] > ~/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 -m pytest --rootdir . --override-ini junit_family=xunit1 --junit-xml=/tmp/tmp-5227399oU3WLyyfScP.xml 2023-12-13 17:19:53.234 [info] cwd: . 2023-12-13 17:19:57.440 [debug] Clearing context for python dependencies not installed: ms-python.python.Python 2023-12-13 17:19:57.440 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 2023-12-13 17:20:03.697 [debug] Clearing context for python dependencies not installed: /home/user/test/pyproject.toml 2023-12-13 17:20:03.700 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 2023-12-13 17:20:11.268 [debug] Clearing context for python dependencies not installed: ms-python.python.Python 2023-12-13 17:20:11.268 [debug] Found cached env for /home/user/.cache/pypoetry/virtualenvs/test-zxyBamcN-py3.11/bin/python3 ```
User Settings
``` languageServer: "Pylance" testing • pytestEnabled: true ```
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
|Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)| |GPU Status|2d_canvas: enabledcanvas_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| |Load (avg)|undefined| |Memory (System)|31.70GB (5.56GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|WSL: Ubuntu-22.04| |OS|Linux x64 5.15.133.1-microsoft-standard-WSL2| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)| |Memory (System)|11.68GB (6.36GB free)| |VM|0%|