Repository navigation
symlink: Pytest immediately finishes without running #22518
Copy link
Copy link
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
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:
- Launch workspace.
- Navigate to the TESTING pane.
- 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.languageServersetting: 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-testingbugIssue identified by VS Code Team member as probable bugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from posterIssue requires more information from poster
Activity
eleanorjboyd commentedon Nov 27, 2023
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.
slochower commentedon Nov 27, 2023
Hi, this is all that I see in Python Test Logs:
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.
It's worth noting 1) this is local, not SSH 2) Running regular old
pyteston the command line works as expected 3) I tried toggling thepythonTestAdapterinsettings.json.eleanorjboyd commentedon Nov 27, 2023
Could you try running this again but this time without
html-3.2.0plugin?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.
slochower commentedon Nov 27, 2023
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):
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?pytest-htmlhad no effect.Edit: I do see
data received:eleanorjboyd commentedon Nov 27, 2023
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
slochower commentedon Nov 27, 2023
I do see something like your logs in mine:
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?
14 remaining items
eleanorjboyd commentedon Feb 26, 2024
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.
kjohnsen commentedon Mar 13, 2024
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:
All is well if I open
scratch/vscode-tests-bug, but not if I openscratch-link/vscode-tests-bugDiagnostic data
python.languageServersetting: PylanceOutput for
Pythonin theOutputpanel (View→Output, change the drop-down the upper-right of theOutputpanel toPython)User Settings
derDere commentedon Mar 14, 2024
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.
nicc777 commentedon Mar 14, 2024
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.
kjohnsen commentedon Mar 19, 2024
Eleanor Boyd (@eleanorjboyd) any update on this issue?
eleanorjboyd commentedon Mar 27, 2024
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!
eleanorjboyd commentedon Mar 27, 2024
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_v3so
/Users/eleanorboyd/Desktop/symlink_desktop_v3->/Users/eleanorboyd/testingFiles/v2/symlink_v3What about my setup do I need to change to see this issue?
kjohnsen commentedon Apr 3, 2024
I see two differences with my setup that might be relevant:
Here is
eleanorjboyd commentedon Apr 16, 2024
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!
kjohnsen commentedon Apr 24, 2024
I just updated and ran again and it's fixed!
I assume you mean trace for Python logging? I do see that:

I see a

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