Skip to content
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

When i restart my unittest, it will automatically execute all test cases. #224359

Closed
yuanzhe-tian opened this issue Jul 31, 2024 · 9 comments
Closed
Assignees

Comments

@yuanzhe-tian
Copy link

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version:
  • OS Version:

Steps to Reproduce:

Here is my workspace file.
image

  1. make workspace, and midir test dir named test, and make an test file named test_2.py, outside the test folder.
  2. set config, "python.testing.pytestArgs": ["test"] in workspace setting.
  3. click debug button front of test_11122.
    image
    It not only restarted the unit test I had previously run, but also started another test. And another test is not in the testing directory of the configuration file.
    image
@eleanorjboyd
Copy link
Member

Hi! Thanks for the bug report! Are you able to send all of your logs from the python output channel? Im looking for a line which says something like- running pytest with args: or somewhere listing the testIds

@yuanzhe-tian
Copy link
Author

this is my Full log, from DEBUG CONSOLE

Error: Could not connect to runTestIdsPort: [Errno 2] No such file or directory: '\\.\pipe\python-test-ids-951766bd95042746d857-sock'
Error: Could not connect to runTestIdsPort
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir=d:\Workspace\working', '--capture=no']
============================= test session starts =============================
platform win32 -- Python 3.12.3, pytest-8.3.2, pluggy-1.5.0
rootdir: d:\Workspace\working
111111
111111
111111
111111

Running Debug on Windows.

@yuanzhe-tian
Copy link
Author

Version: 1.92.0 (user setup)
Commit: b1c0a14
Date: 2024-07-31T23:26:45.634Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

@TheoBoyer
Copy link

TheoBoyer commented Aug 22, 2024

Same problem on Ubuntu

Python output channel - debug level:

...
2024-08-22 11:57:53.330 [info] Using configuration in workspace
2024-08-22 11:57:53.330 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.330 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.345 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.346 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.346 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.348 [debug] CreateEnv Trigger - skipping this because it was already run
2024-08-22 11:57:53.444 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.450 [debug] Extension ms-python.debugpy accessed resolveEnvironment with args: {"id":"<ENV_PATH>/bin/python","path":"<ENV_PATH>/bin/python"}
2024-08-22 11:57:53.450 [debug] Extension ms-python.debugpy accessed getActiveEnvironmentPath with args: undefined
2024-08-22 11:57:53.458 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:57:53.468 [debug] Extension ms-python.debugpy accessed resolveEnvironment with args: "<ENV_PATH>/bin/python"
2024-08-22 11:57:54.478 [debug] new client is connected to the socket, connectionCount:  1 /run/user/1000/python-test-ids-3117b68b8b7d61fc35d8.sock
2024-08-22 11:57:54.478 [debug] Test Ids named pipe connected
2024-08-22 11:57:54.478 [debug] client emitted close event, connectionCount:  0
2024-08-22 11:57:54.478 [debug] connection count is <= 0, closing the server:  /run/user/1000/python-test-ids-3117b68b8b7d61fc35d8.sock
2024-08-22 11:57:58.197 [debug] Found cached env for <ENV_PATH>/bin/python
** Hits restart**
2024-08-22 11:58:01.340 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:58:19.840 [debug] Finished running tests, ending runInstance.
2024-08-22 11:58:20.118 [debug] Found cached env for <ENV_PATH>/bin/python
2024-08-22 11:58:20.130 [debug] Extension ms-python.debugpy accessed resolveEnvironment with args: "<ENV_PATH>/bin/python"
2024-08-22 11:58:27.226 [debug] new client is connected to the socket, connectionCount:  1 /run/user/1000/python-test-results-cdefed79ed4a947e7fb6.sock
2024-08-22 11:58:27.226 [debug] Test Result named pipe /run/user/1000/python-test-results-cdefed79ed4a947e7fb6.sock connected
2024-08-22 11:58:27.226 [debug] Test Result named pipe /run/user/1000/python-test-results-cdefed79ed4a947e7fb6.sock received data
2024-08-22 11:58:28.831 [debug] Test Result named pipe /run/user/1000/python-test-results-cdefed79ed4a947e7fb6.sock received data
...

When hitting restart, run_pytest_script.py of vscode-python seems to be trying to open /run/user/1000/python-test-ids-3117b68b8b7d61fc35d8.sock based on the value of RUN_TEST_IDS_PIPE when it is in fact closed

About:
Version: 1.92.1
Commit: eaa41d5
Date: 2024-08-07T20:16:39.455Z
Electron: 30.1.2
ElectronBuildId: 9870757
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.8.0-40-generic

@TheoBoyer
Copy link

For those having this bug, as a temporary workaround you can stop the debugger (button or Shift+f5) then click the arrow in the "Testing" tab on the left or press Ctrl+;L
image

@eleanorjboyd
Copy link
Member

Hi! This should be fixed in the newest update coming out this week on stable or out on pre-release right now. We did some work to make sure the restart debug was working correctly. Let me know if you see this fixing the problem or if its persists

@yuanzhe-tian
Copy link
Author

It doesn't seem to have been repaired

this is my debug log:
Error: Could not connect to runTestIdsPort: [Errno 2] No such file or directory: '\\.\pipe\python-test-ids-cd53a04f4490adf84819-sock'
Error: Could not connect to runTestIdsPort
Error: No test ids received from stdin, could be an error or a run request without ids provided.
Running pytest with no test ids as args. Args being used: ['--rootdir=d:\Workspace\working', '--capture=no']

image
click restart button, all test case still be on.

@yuanzhe-tian
Copy link
Author

Version: 1.93.0 (user setup)
Commit: 4849ca9
Date: 2024-09-04T13:02:38.431Z
Electron: 30.4.0
ElectronBuildId: 10073054
Chromium: 124.0.6367.243
Node.js: 20.15.1
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.22631

@eleanorjboyd
Copy link
Member

closing as a dup of this other issue but this is on my list of items to work on next month! microsoft/vscode-python-debugger#338

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Dec 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants