You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to set up test discovery with unittest, I can only get pytest to trigger discovery to trigger. Even though I have the following settings in my workspace:
Add a file called e.g. test_1.py with the following content:
importunittestclassTestStringMethods(unittest.TestCase):
deftest_upper(self):
self.assertEqual("hello".upper(), "HELLO")
deftest_isupper(self):
self.assertTrue("HELLO".isupper())
self.assertFalse("Hello".isupper())
deftest_split(self):
s="hello world"self.assertEqual(s.split(), ["hello", "world"])
# check that s.split fails when the separator is not a stringwithself.assertRaises(TypeError):
s.split(2)
Click on the test explorer, select configure tests, select "unittest" and then "." and then "test_*.py"
See that it will fail pytest discovery
Diagnostic data
Python version (& distribution if applicable, e.g. Anaconda): 3.12.0
Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Global
Value of the python.languageServer setting: Pylance
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
024-02-01 18:09:54.242 [debug] Testing: Manually triggered test refresh
2024-02-01 18:09:54.242 [debug] Testing: Clearing all discovered tests
2024-02-01 18:09:54.242 [debug] Testing: Forcing test data refresh
2024-02-01 18:09:54.242 [debug] Testing: Refreshing all test data
2024-02-01 18:09:54.242 [debug] Found cached env for REDACTED\AppData\Local\Programs\Python\Python312\python.exe
2024-02-01 18:09:54.244 [info] Discover tests for workspace name: sample - uri: REDACTED\Apps\sample
2024-02-01 18:09:54.244 [info] Running discovery for unittest using the new test adapter.
2024-02-01 18:09:54.245 [info] All environment variables set for pytest discovery for workspace REDACTED\Apps\sample: REDACTED
2024-02-01 18:09:54.245 [debug] Found cached env for REDACTED\AppData\Local\Programs\Python\Python312\python.exe
2024-02-01 18:09:54.263 [debug] Activation Commands received undefined for shell cmd, resource REDACTED\Apps\sample and interpreter REDACTED\AppData\Local\Programs\Python\Python312\python.exe
2024-02-01 18:09:54.279 [debug] Running pytest discovery with command: -m pytest -p vscode_pytest --collect-only for workspace REDACTED\Apps\sample.
2024-02-01 18:09:54.280 [info] > ~\AppData\Local\Programs\Python\Python312\python.exe -m pytest -p vscode_pytest --collect-only
2024-02-01 18:09:54.280 [info] cwd: .
2024-02-01 18:09:54.353 [error] REDACTED\AppData\Local\Programs\Python\Python312\python.exe: No module named pytest
2024-02-01 18:09:54.363 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace REDACTED\Apps\sample.
2024-02-01 18:09:54.363 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace REDACTED\Apps\sample. Creating and sending error discovery payload
2024-02-01 18:09:54.363 [error] pytest test discovery error for workspace: REDACTED\Apps\sample
The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace REDACTED\Apps\sample
2024-02-01 18:09:54.363 [info] ResultResolver EOT received for discovery.
2024-02-01 18:09:54.363 [debug] deferredTill EOT resolved for REDACTED\Apps\sample
2024-02-01 18:09:54.363 [info] Disposing data receiver for REDACTED\Apps\sample and deleting UUID; pytest discovery.
luabud
changed the title
Pytest discovered is triggered even though unittest is the enabled framework
Pytest discovery is triggered even though unittest is the enabled framework
Feb 2, 2024
Type: Bug
Behaviour
When trying to set up test discovery with unittest, I can only get pytest to trigger discovery to trigger. Even though I have the following settings in my workspace:
Steps to reproduce:
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: 2024.0.0
VS Code version: Code - Insiders 1.87.0-insider (442c133fe92b5e2606c8242caae4e68938faccc7, 2024-02-01T09:49:33.086Z)
OS version: Windows_NT x64 10.0.22621
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
skia_graphite: disabled_off
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: