Skip to content

symlink: Pytest immediately finishes without running #22518

Closed

Description

Type: Bug

Behaviour

Expected vs. Actual

Actual: Tests are discovered in the GUI, but running any test immediately shows "Finished running tests!" in the Test Results pane, without running the test.

Expected: Clicking the arrow next to a test (or all tests) runs the test.

Steps to reproduce:

  1. Launch workspace.
  2. Navigate to the TESTING pane.
  3. Try to run any/all tests.

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.12
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Poetry
  • Value of the python.languageServer setting: Default
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

(Some names scrambled...)

2023-11-22 11:31:58.429 [info] Experiment 'pythonREPLSmartSend' is active
2023-11-22 11:31:58.429 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-11-22 11:31:58.430 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-11-22 11:31:58.430 [info] Experiment 'pythonRecommendTensorboardExtcf' is active
2023-11-22 11:31:58.430 [info] Experiment 'pythonTestAdapter' is active
2023-11-22 11:31:58.430 [info] Default formatter is set to charliermarsh.ruff for workspace /Users/slochowe/projects/vx-xxx
2023-11-22 11:31:58.430 [info] Running installed packages checker:  /Users/slochowe/projects/vx-xxx/.venv/bin/python /Users/slochowe/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/installed_check.py /Users/slochowe/projects/vx-xxx/pyproject.toml
2023-11-22 11:31:58.430 [info] > ./.venv/bin/python ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/installed_check.py ./pyproject.toml
2023-11-22 11:31:58.430 [info] Test server listening.
2023-11-22 11:31:58.430 [info] Python interpreter path: ./.venv/bin/python
2023-11-22 11:32:00.920 [info] Starting Pylance language server.
2023-11-22 11:32:36.032 [info] Discover tests for workspace name: vx-xxx - uri: /Users/slochowe/projects/vx-xxx
2023-11-22 11:32:36.033 [info] Running discovery for pytest using the new test adapter.
2023-11-22 11:32:36.033 [info] All environment variables set for pytest discovery: {"SQLALCHEMY_SILENCE_UBER_WARNING":"1","SCHRODINGER":"/opt/schrodinger/suites2022-3/","BROWSER":"open","COMMAND_MODE":"unix2003","CONDA_DEFAULT_ENV":"base","CONDA_EXE":"/opt/anaconda3/bin/conda","CONDA_PREFIX":"/opt/anaconda3","CONDA_PROMPT_MODIFIER":"(base) ","CONDA_PYTHON_EXE":"/opt/anaconda3/bin/python","CONDA_SHLVL":"1","DISPLAY":"/private/tmp/com.apple.launchd.Q3tHYQNAHa/org.xquartz:0","EDITOR":"nano","GREP_COLOR":"37;45","GREP_COLORS":"mt=37;45","HOME":"/Users/slochowe","JAVA_HOME":"/Library/Java/JavaVirtualMachines/jdk-18.0.2.jdk","LANG":"en_US.UTF-8","LESS":"-F -g -i -M -R -S -w -X -z-4","LESS_TERMCAP_mb":"\u001b[01;31m","LESS_TERMCAP_md":"\u001b[01;31m","LESS_TERMCAP_me":"\u001b[0m","LESS_TERMCAP_se":"\u001b[0m","LESS_TERMCAP_so":"\u001b[00;47;30m","LESS_TERMCAP_ue":"\u001b[0m","LESS_TERMCAP_us":"\u001b[01;32m","LOGNAME":"slochowe","LSCOLORS":"exfxcxdxbxGxDxabagacad","LS_COLORS":"di=34:ln=35:so=32:pi=33:ex=31:bd=36;01:cd=33;01:su=31;40;07:sg=36;40;07:tw=32;40;07:ow=33;40;07:","MallocNanoZone":"0","OLDPWD":"/","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","PAGER":"less","PWD":"/","SHELL":"/bin/zsh","SHLVL":"0","SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.KfeUvKK69V/Listeners","TMPDIR":"/var/folders/0k/wn1cythd0_s0h7_zc0j88r_00001cx/T/","USER":"slochowe","VISUAL":"nano","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"/Users/slochowe/Library/Application Support/Code/CachedData/2b35e1e6d88f1ce073683991d1eff5284a32690f","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"/","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"/Users/slochowe/Library/Application Support/Code/1.84-main.sock","VSCODE_NLS_CONFIG":"{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}","VSCODE_PID":"79124","XPC_FLAGS":"0x0","XPC_SERVICE_NAME":"application.com.microsoft.VSCode.129823046.129823052","_":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","__CFBundleIdentifier":"com.microsoft.VSCode","__CF_USER_TEXT_ENCODING":"0x59D:0x0:0x0","ELECTRON_RUN_AS_NODE":"1","VSCODE_L10N_BUNDLE_LOCATION":"","PATH":"/Applications/VIDA 4.3.0.4.app/Contents/MacOS/bin:/Applications/VIDA 4.3.0.4.app/Contents/MacOS/bin:/Applications/VIDA 4.3.0.4.app/Contents/MacOS/bin:/Applications/VIDA 4.3.0.4.app/Contents/MacOS/bin:/Users/slochowe/.local/bin/:/opt/anaconda3/bin:/opt/anaconda3/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/laps:/opt/X11/bin:/Applications/quarto/bin:/Users/slochowe/.fzf/bin","PYTHONPATH":"/Users/slochowe/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles","TEST_UUID":"4bcd3756-6e9a-42b9-912c-ceed7fd4f4c6","TEST_PORT":"50592"}
2023-11-22 11:32:36.055 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2023.20.0/pythonFiles/printEnvVariables.py
2023-11-22 11:32:36.055 [info] shell: bash
2023-11-22 11:32:36.120 [info] > ./.venv/bin/python -m pytest -p vscode_pytest --collect-only tests
2023-11-22 11:32:36.120 [info] cwd: .
2023-11-22 11:32:36.534 [info] �[1m============================= test session starts ==============================�[0m
platform darwin -- Python 3.10.12, pytest-7.2.2, pluggy-1.3.0

2023-11-22 11:32:36.540 [info] rootdir: /Volumes/OWC/projects/vx-xxx, configfile: pyproject.toml
plugins: html-3.2.0, metadata-3.0.0, dependency-0.5.1, cov-4.0.0

2023-11-22 11:32:42.235 [info] collected 18 items

<Module tests/test_cli.py>
2023-11-22 11:32:42.235 [info] 
  <Function test_1>
  <Function test_2>
  <Function test_3>
<Module tests/test_fetch.py>
  <Function test_x>
  <Function test_y>
  <Function test_z>
<Module tests/test_import.py>
  <Function test_1>
  <Function test_2>
  <Function test_3>
  <Function test_4>
<Module tests/test_alpha.py>
  <Function test_a>
  <Function test_b>
<Module tests/test_beta.py>
  <Function test_1>
<Module tests/test_gamma.py>
  <Function test_a>
<Module tests/test_delta.py>
  <Function test_x>
  <Function test_y>
  <Function test_z>
  <Function test_q>

2023-11-22 11:32:42.246 [info] Test server connected to a client.
2023-11-22 11:32:42.253 [info] ResultResolver EOT received for discovery.
2023-11-22 11:32:42.253 [info] 
- generated xml file: /Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.xml -
- generated html file: file:///Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.html -
�[32m========================= �[32m18 tests collected�[0m�[32m in 5.71s�[0m�[32m ==========================�[0m

2023-11-22 11:32:42.633 [info] Disposing data receiver for /Users/slochowe/projects/vx-xxx and deleting UUID; pytest discovery.
2023-11-22 11:37:17.149 [info] > conda info --json

User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

experiments
• optInto: ["pythonREPLSmartSend"]

Extension version: 2023.20.0
VS Code version: Code 1.84.1 (2b35e1e6d88f1ce073683991d1eff5284a32690f, 2023-11-06T12:37:18.666Z)
OS version: Darwin x64 21.6.0
Modes:

System Info
Item Value
CPUs Intel(R) Xeon(R) W-3223 CPU @ 3.50GHz (16 x 3500)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
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
Load (avg) 7, 7, 6
Memory (System) 48.00GB (2.72GB free)
Process Argv --crash-reporter-id cb48efa2-f1ba-49ea-ab73-be7b0e1a36ce
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931:30280409
vshan820:30294714
vstes263:30335439
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30880072
a247i228:30880122
vsclangdc:30486549
c4g48928:30535728
dsvsc012:30540252
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
89544117:30613380
vscrp:30673768
2i9eh265:30646982
showlangstatbar:30737416
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
welcomedialogc:30887144
pythonnosmt12:30797651
pythonidxpt:30866567
pythonnoceb:30805159
synctok:30869157
dsvsc013:30795093
dsvsc014:30804076
dsvsc015:30845448
pythontestfixt:30871694
pythonregdiag2:30871582
pyreplss1:30897532
pythonmypyd1:30879173
pythoncet0:30885854
2e7ec940:30885897
pythontbext0:30879054
accentitlementsc:30887149
dsvsc016cf:30886111
dsvsc017cf:30886113
dsvsc018:30886114
aa_t_chat:30882232

Activity

  1. eleanorjboyd commented on Nov 27, 2023

    @eleanorjboyd
    Member

    Hi! Could you check in your "python test logs" and send those? Might be something happening on the python side which shows up there. Also to confirm these are all the logs right after you click the run button? I am seeing no logs related to an attempted run since after clicking the "play" button there are usually additional logs printed right away.

  2. slochower commented on Nov 27, 2023

    @slochower
    Author

    Hi, this is all that I see in Python Test Logs:

    �[1m============================= test session starts ==============================�[0m
    platform darwin -- Python 3.10.12, pytest-7.2.2, pluggy-1.3.0
    rootdir: /Volumes/OWC/projects/vx-xxx, configfile: pyproject.toml
    plugins: anyio-4.0.0, html-3.2.0, metadata-3.0.0, dependency-0.5.1, cov-4.0.0, xdist-3.5.0
    collected 18 items
    
    <Module tests/test_cli.py>
      [...all tests listed here...]
      <Function test_extract>
    
    - generated xml file: /Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.xml -
    - generated html file: file:///Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.html -
    �[32m========================= �[32m18 tests collected�[0m�[32m in 7.12s�[0m�[32m ==========================�[0m
    Starting now, all test run output will be sent to the Test Result panel, while test discovery output will be sent to the "Python" output channel instead of the "Python Test Log" channel. The "Python Test Log" channel will be deprecated within the next month. See https://github.com/microsoft/vscode-python/wiki/New-Method-for-Output-Handling-in-Python-Testing for details.
    

    This is right after I click the play button on the sidebar under Testing, yep.

    Nothing new shows up in the Python logs, here is the last snippet of those.

    
    2023-11-27 11:06:29.909 [info] Test server connected to a client.
    2023-11-27 11:06:29.913 [info] ResultResolver EOT received for discovery.
    2023-11-27 11:06:29.913 [info] 
    - generated xml file: /Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.xml -
    - generated html file: file:///Volumes/OWC/projects/vx-xxx/test-results/unit-tests-results.html -
    �[32m========================= �[32m18 tests collected�[0m�[32m in 7.12s�[0m�[32m ==========================�[0m
    
    2023-11-27 11:06:30.277 [info] Disposing data receiver for /Users/slochowe/projects/vx-xxx and deleting UUID; pytest discovery.
    

    It's worth noting 1) this is local, not SSH 2) Running regular old pytest on the command line works as expected 3) I tried toggling the pythonTestAdapter in settings.json.

  3. eleanorjboyd commented on Nov 27, 2023

    @eleanorjboyd
    Member

    Could you try running this again but this time without html-3.2.0 plugin?

    Secondly do you see anything in your logs which say "data received from python server:"? It is a debug level so maybe setting your log level via the command palette "developer: set log level" to debug or trace could help produce these logs which give a better idea of what could be happening.

  4. slochower commented on Nov 27, 2023

    @slochower
    Author

    Actually, after a delay (7 minutes) I do see these messages in the Python log (first message in the snippet below is the last message from my last reply):

    2023-11-27 11:06:30.277 [info] Disposing data receiver for /Users/slochowe/projects/vx-xxx and deleting UUID; pytest discovery.
    2023-11-27 11:13:15.869 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:15.869 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:15.869 [error] Unable to find workspace for given file
    2023-11-27 11:13:21.968 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:21.968 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:21.968 [error] Unable to find workspace for given file
    2023-11-27 11:13:24.016 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:24.016 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:24.016 [error] Unable to find workspace for given file
    2023-11-27 11:13:26.016 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:26.016 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:26.016 [error] Unable to find workspace for given file
    2023-11-27 11:13:28.584 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:28.584 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:28.585 [error] Unable to find workspace for given file
    2023-11-27 11:13:46.964 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:46.964 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:46.964 [error] Unable to find workspace for given file
    2023-11-27 11:13:54.618 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:13:54.618 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:13:54.619 [error] Unable to find workspace for given file
    2023-11-27 11:14:00.322 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:00.322 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:14:00.322 [error] Unable to find workspace for given file
    2023-11-27 11:14:08.887 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:08.887 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:14:08.887 [error] Unable to find workspace for given file
    2023-11-27 11:14:20.873 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:20.873 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:14:20.873 [error] Unable to find workspace for given file
    2023-11-27 11:14:30.672 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:30.672 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:14:30.672 [error] Unable to find workspace for given file
    2023-11-27 11:14:44.542 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:44.542 [info] Running discovery for pytest using the new test adapter.
    2023-11-27 11:14:44.542 [error] Unable to find workspace for given file
    2023-11-27 11:14:49.948 [info] Discover tests for workspace name: undefined - uri: /Volumes/OWC/projects/vx-xxx/src/vx_xxx/tasks/import_.py
    2023-11-27 11:14:49.948 [info] Running discovery for pytest using the new test adapter.
    

    Is this helpful?

    You see two paths here: /Volumes/OWC/projects/... and /Users/slochowe/projects/... the former is symlinked to the latter. Is the issue a failure to follow the symlink?

    • Uninstalling pytest-html had no effect.
    • I do not see "data received..." anywhere. I went to the DEBUG log level and I see a bunch of "Found cached env...", "Resolved...", and "Cached data exists..."

    Edit: I do see data received:

    {"cwd": "/Volumes/OWC/projects/vx-xxx", "status": "success", "tests": {"name": "vx-xxx", "path": "/Volumes/OWC/projects/vx-xxx", "type_": "folder", "children": [{"name": "tests", "path": "/Volumes/OWC/projects/vx-xxx/tests", "type_": "folder", "id_": "/Volumes/OWC/projects/vx-xxx/tests", "children": [{"name": "test_cli.py", "path": "/Volumes/OWC/projects/vx-xxx/tests/test_cli.py", "type_": "file", "id_": "/Volumes/OWC/projects/vx-xxx/tests/test_cli.py", "children": [..."id_": "/Volumes/OWC/projects/vx-xxx"}, "error": []}Content-Length: 42
    Content-Type: application/json
    Request-uuid: 810db473-f7c5-45d2-b960-9039579a3239
    
  5. added
    info-neededIssue requires more information from poster
    and removed
    info-neededIssue requires more information from poster
    on Nov 27, 2023
  6. eleanorjboyd commented on Nov 27, 2023

    @eleanorjboyd
    Member

    hm yes we have been having ongoing issues with symlinks. Does this look like it could be similar? #22018

    secondly do you see the following as well in your logs (below is the example with my own logs of the necessary steps it prints after getting the data)? It seems your data is returning correctly from the pytest process but is not being parsed and displayed correctly

    2023-11-27 15:31:40.979 [debug] Firing data received event,  {"command_type": "execution", "eot": true}
    2023-11-27 15:31:40.979 [info] ResultResolver EOT received for execution.
    2023-11-27 15:31:40.991 [info] Client disconnected
    2023-11-27 15:31:40.997 [debug] Test run finished, subprocess closed.
    2023-11-27 15:31:40.997 [debug] deferredTill EOT resolved
    2023-11-27 15:31:40.998 [info] Disposing data receiver for /Users/eleanorboyd/testingFiles/inc_dec_example and deleting UUID; pytest execution.
    
  7. slochower commented on Nov 27, 2023

    @slochower
    Author

    I do see something like your logs in mine:

    2023-11-27 15:37:29.578 [info] ResultResolver EOT received for discovery.
    2023-11-27 15:37:29.578 [info] 
    ========================= 18 tests collected in 8.44s ==========================
    
    2023-11-27 15:37:29.780 [debug] Testing: Resolving item /Volumes/OWC/projects/vx-xxx
    2023-11-27 15:37:29.781 [debug] Testing: Resolving item /Volumes/OWC/projects/vx-xxx/tests
    2023-11-27 15:37:29.781 [debug] Testing: Resolving item /Volumes/OWC/projects/vx-xxx/tests/test_asdfasldfasdklfjasdf.py
    2023-11-27 15:37:29.956 [debug] deferredTill EOT resolved
    2023-11-27 15:37:29.957 [info] Disposing data receiver for /Users/slochowe/projects/vx-xxx and deleting UUID; pytest discovery.
    

    Okay, yes this is somehow related to the symlink. I opened from the non-symlinked (i.e., source) location, ran a test, and it worked. I then opened again from the symlinked version and testing is working. Perhaps something with caching an unresolved path?

  8. 14 remaining items

  9. added
    bugIssue identified by VS Code Team member as probable bug
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 25, 2024
  10. eleanorjboyd commented on Feb 26, 2024

    @eleanorjboyd
    Member

    Hello! This bug should be fixed and on vscode insiders! The release to vscode stable will be out by the end of the week. Please let me know if you try it on insiders or stable when it comes out and still doesn't work and I can investigate your specific issue further.

  11. kjohnsen commented on Mar 13, 2024

    @kjohnsen

    I'm still running into this problem. I'm using Python extension v2024.3.10731011 (pre-release).
    It happens when I'm in a symlinked directory somewhere up the line. My file structure is as follows:

    scratch-link -> scratch
    scratch
    └── vscode-tests-bug
        └── tests
            └── test_test.py
    

    All is well if I open scratch/vscode-tests-bug, but not if I open scratch-link/vscode-tests-bug

    image

    Diagnostic data

    • Python version (& distribution if applicable, e.g. Anaconda): 3.12.1
    • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
    • 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)

    2024-03-13 15:38:00.320 [info] > conda run -n base --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/printEnvVariables.py
    2024-03-13 15:38:00.320 [info] shell: bash
    2024-03-13 15:38:00.329 [info] > conda info --json
    2024-03-13 15:38:00.329 [info] shell: zsh
    2024-03-13 15:38:00.329 [info] Python interpreter path: ~/miniforge3/bin/python
    2024-03-13 15:38:01.214 [info] > conda run -n base --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/get_output_via_markers.py -m pytest -p vscode_pytest --collect-only tests
    2024-03-13 15:38:01.214 [info] cwd: .
    2024-03-13 15:38:01.711 [info] Discover tests for workspace name: vscode-tests-bug - uri: /home/kyle/scratch-link/vscode-tests-bug
    2024-03-13 15:38:01.711 [info] Running discovery for pytest using the new test adapter.
    2024-03-13 15:38:01.711 [error] Test discovery already in progress, not starting a new one.
    2024-03-13 15:38:01.894 [info] >>>PYTHON-EXEC-OUTPUT
    
    2024-03-13 15:38:01.926 [info] > conda run -n base --no-capture-output python ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/get_output_via_markers.py ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/printEnvVariables.py
    2024-03-13 15:38:01.926 [info] shell: zsh
    2024-03-13 15:38:02.086 [info] tests/test_test.py::test_foo
    
    2024-03-13 15:38:02.086 [info] Test server connected to a client.
    2024-03-13 15:38:02.087 [info] 
    1 test collected in 0.00s
    <<<PYTHON-EXEC-OUTPUT
    
    2024-03-13 15:38:02.089 [info] ResultResolver EOT received for discovery.
    2024-03-13 15:38:02.154 [info] Disposing data receiver for /home/kyle/scratch-link/vscode-tests-bug and deleting UUID; pytest discovery.
    2024-03-13 15:38:02.680 [info] > /bin/python3 ~/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/printEnvVariables.py
    2024-03-13 15:38:02.680 [info] shell: zsh
    2024-03-13 15:38:03.701 [info] Setting environment variable CONDA_ROOT in collection to /home/kyle/miniforge3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
    2024-03-13 15:38:03.702 [info] Send text to terminal: /bin/python3 /home/kyle/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/printEnvVariablesToFile.py /home/kyle/.vscode-server-insiders/extensions/ms-python.python-2024.3.10731011/python_files/deactivate/zsh/envVars.txt
    
    

    User Settings

    
    languageServer: "Pylance"
    
    testing
    • pytestEnabled: true
    • autoTestDiscoverOnSaveEnabled: false
    
    

  12. derDere commented on Mar 14, 2024

    @derDere

    I'm still running into this problem. I'm using Python extension v2024.3.10731011 (pre-release). It happens when I'm in a symlinked directory somewhere up the line. My file structure is as follows:

    scratch-link -> scratch
    scratch
    └── vscode-tests-bug
        └── tests
            └── test_test.py
    

    All is well if I open scratch/vscode-tests-bug, but not if I open scratch-link/vscode-tests-bug

    image

    Diagnostic data

    • Python version (& distribution if applicable, e.g. Anaconda): 3.12.1
    • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
    • 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)
    User Settings

    I can confirm this issue my vscode has the same behaviour. I am inside my WSL and in my home dir i have a documents symlink linked to a WSL folder inside my windows file system (my documents).

    documents -> '/mnt/d/Users/myusername/WSL Home Contents/Documents'

    If im inside of that symlink my vscode doesn't load any tests. If I move my workspace into an "normal" WSL folder /home/myusername/workspace It runs the tests normally as intended.

  13. nicc777 commented on Mar 14, 2024

    @nicc777

    derDere (@derDere) - Sounds similar to my case. It should work if you open "/mnt/d/Users/myusername/WSL Home Contents/Documents'" - can you confirm? I have a similar situation on my work laptop (using WSL) but these days I just keep my git repo in WSL and be done with it. You can easily navigate from Windows to that WSL directory if you need to.

  14. kjohnsen commented on Mar 19, 2024

    @kjohnsen

    Eleanor Boyd (@eleanorjboyd) any update on this issue?

  15. eleanorjboyd commented on Mar 27, 2024

    @eleanorjboyd
    Member

    Hello, sorry for the delay as I have been working on other areas. I will investigate this soon and get back to you all- thank you for the detailed repro steps!

  16. eleanorjboyd commented on Mar 27, 2024

    @eleanorjboyd
    Member

    I have made the following symlink to try and repro your scenario and am able to get tests working:

    ln -s /Users/eleanorboyd/testingFiles/v2/symlink_v3 /Users/eleanorboyd/Desktop/symlink_desktop_v3
    so /Users/eleanorboyd/Desktop/symlink_desktop_v3 -> /Users/eleanorboyd/testingFiles/v2/symlink_v3

    What about my setup do I need to change to see this issue?

  17. kjohnsen commented on Apr 3, 2024

    @kjohnsen

    I see two differences with my setup that might be relevant:

    1. Are you on WSL?
    2. The workspace folder itself isn't a symlink, but the folder containing the workspace folder. I tried your setup (where the workspace folder is the one symlinked) and the tests work. So this detail is important for sure.

    Here is

    scratch/vscode-tests-bug  |  scratch-link/vscode-tests-bug  |  testsbug2 -> vscode-tests-bug
    

    image

  18. eleanorjboyd commented on Apr 16, 2024

    @eleanorjboyd
    Member

    Can you turn on trace for logs then send me them? I need to see if the symlink is recognized by vscode and if it even hits my edge case I put in to resolve it. I have a mac so I am having trouble reproing since it seems vscode resolves paths. What I am seeing is I can't to open the symlink sub-folder without vscode resolving it. I can also speak with my colleague who works on that specifically.

    The logs should include this trace log if it recognizes it as a symlink and adjust accordingly "The cwd is a symbolic link, adding '--rootdir' to pytestArgs only if it doesn't already exist." so you can see that during discovery.

    Also is both discovery and execution breaking or just one of those which does work? And to confirm you are using pytest right?

    Sorry for all the questions and I appreciate your help!

  19. kjohnsen commented on Apr 24, 2024

    @kjohnsen

    I just updated and ran again and it's fixed!

    I assume you mean trace for Python logging? I do see that:
    image

    I see a plugin warning on execution:
    image

    And the error was just on execution, not discovery. Yes, using pytest.

  20. locked as resolved and limited conversation to collaborators on May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions