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

Unable to run tests with pythonTestAdapter enabled #22250

Closed
heidimhurst opened this issue Oct 18, 2023 · 17 comments
Closed

Unable to run tests with pythonTestAdapter enabled #22250

heidimhurst opened this issue Oct 18, 2023 · 17 comments
Assignees
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@heidimhurst
Copy link

Type: Bug

Behaviour

Expected vs. Actual

Tests are currently not running for me using the python testing plugin as previous. When I run a test by clicking the GUI arrow in the test pane, the test hangs indefinitely. In the Python Test Log, I get the following error:

>>>PYTHON-EXEC-OUTPUT
Error: Could not connect to runTestIdsPort: [Errno 60] Operation timed out
Error: Could not connect to runTestIdsPort
<<<PYTHON-EXEC-OUTPUT

This only happens when I set "python.experiments.optInto": ["pythonTestAdapter"] in my settings.json file; if I explicitly opt out of that experiment, this issue does not recur.

I am able to run tests in the terminal in the same environment (conda) using pytest directly without issue.

Steps to reproduce:

  1. Enable pythonTestAdapter via "python.experiments.optInto": ["pythonTestAdapter"] in settings.json.
  2. Try to run a simple test, like the following:
def test_test_setup():
    assert 0 == 1

Diagnostic data

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

2023-10-18 11:23:46.371 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:23:46.371 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:23:46.371 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:23:46.376 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:23:46.376 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:23:46.376 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:23:46.381 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:23:46.382 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:23:46.382 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.getCondaVersion-Args=
2023-10-18 11:23:46.384 [debug] Found executable within conda env {"name":"sci-ops-dev","prefix":"/Users/hh/mambaforge/envs/sci-ops-dev"}
2023-10-18 11:23:46.385 [info] Server listening on port 51826
2023-10-18 11:23:46.385 [debug] Server started for pytest test ids server and listening on port 51826
2023-10-18 11:23:46.392 [info] Running pytest with arguments: /Users/hh/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/vscode_pytest/run_pytest_script.py --rootdir /Users/hh/Documents/Pachama/sci-ops

2023-10-18 11:23:46.392 [info] > conda run -n sci-ops-dev --no-capture-output python ~/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/vscode_pytest/run_pytest_script.py --rootdir .
2023-10-18 11:23:46.392 [info] cwd: .
2023-10-18 11:23:46.441 [debug] Clearing context for python dependencies not installed: /Users/hh/Documents/Pachama/sci-ops/tests/unit/flyte/project_evaluation/tasks/test_evaluation.py
2023-10-18 11:23:48.902 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:23:48.903 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:23:48.903 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:23:48.913 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:23:48.913 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-18 11:23:48.914 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:23:48.914 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:23:48.914 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/Users/hh/mambaforge/envs/sci-ops-dev/bin/python"-Arg-Separator-undefined
2023-10-18 11:23:48.954 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-18 11:24:06.185 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:24:06.185 [debug] Clearing context for python dependencies not installed: /Users/hh/Documents/Pachama/sci-ops/tests/unit/flyte/project_evaluation/tasks/test_evaluation.py
2023-10-18 11:24:06.186 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:24:06.186 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:24:06.186 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/Users/hh/mambaforge/envs/sci-ops-dev/bin/python"-Arg-Separator-{"uri":{"$mid":1,"fsPath":"/Users/hh/Documents/Pachama/sci-ops","external":"file:///Users/hh/Documents/Pachama/sci-ops","path":"/Users/hh/Documents/Pachama/sci-ops","scheme":"file"},"name":"sci-ops","index":0}
2023-10-18 11:24:06.214 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:24:06.214 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:24:06.214 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:24:06.232 [debug] Clearing context for python dependencies not installed: /Users/hh/Documents/Pachama/sci-ops/tests/unit/flyte/project_evaluation/tasks/test_evaluation.py
2023-10-18 11:24:08.672 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:24:08.673 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:24:08.673 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:24:08.696 [debug] Clearing context for python dependencies not installed: /Users/hh/Documents/Pachama/sci-ops/tests/unit/flyte/project_evaluation/tasks/test_evaluation.py
2023-10-18 11:24:13.798 [debug] Test run finished, subprocess closed.
2023-10-18 11:24:24.465 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-18 11:24:24.465 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-18 11:24:24.466 [debug] Found cached env for /Users/hh/mambaforge/envs/sci-ops-dev/bin/python
2023-10-18 11:24:24.466 [debug] Resolved /Users/hh/mambaforge/envs/sci-ops-dev/bin/python from cache: {"name":"sci-ops-dev","location":"/Users/hh/mambaforge/envs/sci-ops-dev","kind":"virt-conda","executable":{"filename":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","sysPrefix":"/Users/hh/mambaforge","ctime":1697620700724,"mtime":1697620700724},"display":"Python 3.10.12 ('sci-ops-dev')","version":{"major":3,"minor":10,"micro":12,"release":{"level":"final","serial":0},"sysVersion":"3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":"Anaconda, Inc."},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sci-ops-dev/bin/python","detailedDisplayName":"Python 3.10.12 ('sci-ops-dev': conda)"}
2023-10-18 11:24:24.466 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/Users/hh/mambaforge/envs/sci-ops-dev/bin/python"-Arg-Separator-undefined

User Settings


envFile: "<placeholder>"

languageServer: "Pylance"

formatting
• provider: "none"

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

experiments
• optInto: ["pythonTestAdapter"]

Extension version: 2023.18.0
VS Code version: Code 1.82.3 (fdb98833154679dbaa7af67a5a29fe19e55c2b73, 2023-10-02T11:06:17.496Z)
OS version: Darwin x64 23.0.0
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz (8 x 2300)
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) 4, 4, 5
Memory (System) 32.00GB (0.04GB free)
Process Argv --crash-reporter-id b3325bff-fe97-4602-b260-db680d47ed2b
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
vshan820:30294714
vstes263:30335439
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30856252
vscaat:30438848
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
f6dab269:30613381
a9j8j154:30646983
showlangstatbar:30737416
a2ce3375:30757347
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxptcf:30805731
pythonnoceb:30805159
copilotsettingt:30859503
dsvsc013:30795093
dsvsc014:30804076
diffeditorv2:30821572
dsvsc015:30845448
pythontbext0:30864172

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Oct 18, 2023
@heidimhurst
Copy link
Author

For anyone else who encounters this, the workaround suggested here to disable the test adapter resolves the issue for me.

@karthiknadig karthiknadig added the bug Issue identified by VS Code Team member as probable bug label Oct 18, 2023
@eleanorjboyd
Copy link
Member

Hi! Do you have any settings to disable port forwarding or something like that? We use ports to communicate between the pytest run and our extension and it seems that could be the issue with Error: Could not connect to runTestIdsPort: [Errno 60] Operation timed out.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 18, 2023
@heidimhurst
Copy link
Author

@eleanorjboyd nope, I have auto forward ports still enabled and the auto forward port source setting on the default value
image

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 19, 2023
@eleanorjboyd
Copy link
Member

Anything on your machine for settings? @karthiknadig any other ideas why it would be blocking the connect in this case?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 19, 2023
@karthiknadig
Copy link
Member

@heidimhurst Are you in a remote or WSL or devcontainer scenario? Would it be possible to share the full logs. I only see the tesdid server not the main server in the logs.

@heidimhurst
Copy link
Author

Hi @karthiknadig - nope, just straight local development. I've tried with and without my VPN on, am not aware of anything else that might be blocking the connection

Output > Python Logs (Trace)
2023-10-20 10:58:23.652 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-20 10:58:23.652 [debug] Clearing context for python dependencies not installed: /Users/hh/Desktop/repro-issue/test_example.py
2023-10-20 10:58:23.653 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:23.653 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:23.654 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12"-Arg-Separator-{"uri":{"$mid":1,"fsPath":"/Users/hh/Desktop/repro-issue","external":"file:///Users/hh/Desktop/repro-issue","path":"/Users/hh/Desktop/repro-issue","scheme":"file"},"name":"repro-issue","index":0}
2023-10-20 10:58:23.667 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-20 10:58:23.669 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:23.669 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:23.671 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-20 10:58:23.671 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:23.671 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:23.699 [debug] Activation Commands received undefined for shell bash
2023-10-20 10:58:23.703 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=false
2023-10-20 10:58:23.704 [debug] Cached data exists KeyPrefix=Cache_Method_Output_y.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/Users/hh/Desktop/repro-issue"-Arg-Separator-undefined
2023-10-20 10:58:23.704 [debug] Cached data exists KeyPrefix=Cache_Method_Output_y.addKeyToStorage-Args="global"-Arg-Separator-"WORKSPACE_FOLDER_INTERPRETER_PATH_/Users/hh/Desktop/repro-issue"-Arg-Separator-undefined
2023-10-20 10:58:23.705 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:23.705 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:23.706 [info] Server listening on port 61687
2023-10-20 10:58:23.706 [debug] Server started for pytest test ids server and listening on port 61687
2023-10-20 10:58:23.710 [info] Running pytest with arguments: /Users/hh/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/vscode_pytest/run_pytest_script.py --rootdir /Users/hh/Desktop/repro-issue

2023-10-20 10:58:23.710 [info] > ~/mambaforge/envs/sample-conda-env/bin/python3.12 ~/.vscode/extensions/ms-python.python-2023.18.0/pythonFiles/vscode_pytest/run_pytest_script.py --rootdir .
2023-10-20 10:58:23.710 [info] cwd: .
2023-10-20 10:58:23.722 [debug] Clearing context for python dependencies not installed: /Users/hh/Desktop/repro-issue/test_example.py
2023-10-20 10:58:26.833 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-20 10:58:26.833 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:26.833 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:26.849 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-20 10:58:26.849 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-20 10:58:26.849 [debug] Found cached env for /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12
2023-10-20 10:58:26.850 [debug] Resolved /Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12 from cache: {"name":"","location":"/Users/hh/mambaforge/envs/sample-conda-env","kind":"unknown","executable":{"filename":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","sysPrefix":"/Users/hh/mambaforge/envs/sample-conda-env","ctime":1697795580436,"mtime":1697795570281},"display":"Python 3.12.0 64-bit","version":{"major":3,"minor":12,"micro":0,"release":{"level":"final","serial":0},"sysVersion":"3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:43:38) [Clang 15.0.7 ]"},"arch":3,"distro":{"org":""},"source":[],"type":"Conda","id":"/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12","detailedDisplayName":"Python 3.12.0 64-bit"}
2023-10-20 10:58:26.850 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/Users/hh/mambaforge/envs/sample-conda-env/bin/python3.12"-Arg-Separator-undefined
2023-10-20 10:58:26.888 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-20 10:58:50.023 [debug] Test run finished, subprocess closed.
Output > Python Test Logs (Trace)
Error: Could not connect to runTestIdsPort: [Errno 60] Operation timed out
Error: Could not connect to runTestIdsPort
Error: Could not connect to runTestIdsPort: [Errno 60] Operation timed out
Error: Could not connect to runTestIdsPort

I'm happy to provide more logs if you point me to what specifically you'd like

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 20, 2023
@eleanorjboyd
Copy link
Member

Let me see if I can put in more in-depth error messaging to check if we got the right env var value to the subprocess that contains the port number. Ill reach out when I have a PR merged. Thanks!!

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 20, 2023
@danleesmith
Copy link

May be of some help: I have been experiencing this exact same bug as well with the caveat being that it only occurs when connected to a VPN.

@jcampbell05
Copy link

I seem to have a variation of this, where VSCode instantly states "Finished running tests!" but doesn't do anything, this is when it has been ran from within a dev container.

@eleanorjboyd
Copy link
Member

@jcampbell05 and @danleesmith could you both send logs for the "python output logs" and "python" logs? Specifically with debugging set to trace.

@heidimhurst it is interesting because from your logs it is clear that there is a socket opened and the environment variable that passes the port number to the subprocess works correctly since you do not have the error message about a null value for the port variable. I can also see from your logs the server is started correctly here Server started for pytest test ids server and listening on port 61687 so then that only leaves the subprocess unable to connect as the fault point. Let me talk with my coworkers more. Thanks

@jcampbell05
Copy link

Specifically with debugging set to trace.

I'm not familiar with how to enable this option but I can certainly get you the logs.

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Oct 24, 2023
@eleanorjboyd
Copy link
Member

Sorry for the confusion, I was moving too fast as I typed out my response. I had meant the log level set to trace. You can do so by going to the command palette and looking for Developer: Set Log Level. Thanks!

@jcampbell05
Copy link

Python Logs

2023-10-25 10:34:44.110 [debug] Firing data received event,  {"command_type": "discovery", "eot": true}
2023-10-25 10:34:44.110 [info] ResultResolver EOT received for discovery.
2023-10-25 10:34:45.802 [debug] deferredTill EOT resolved
2023-10-25 10:34:45.802 [info] Disposing data receiver for /workspace and deleting UUID; pytest discovery.
2023-10-25 10:34:48.464 [debug] Testing: Resolving item /var/task
2023-10-25 10:34:48.465 [debug] Testing: Resolving item /var/task/src
2023-10-25 10:34:48.465 [debug] Testing: Resolving item /var/task/src/__tests__
2023-10-25 10:34:48.465 [debug] Testing: Resolving item /var/task/src/__tests__/test_api.py
2023-10-25 10:34:59.572 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-25 10:34:59.575 [debug] Found cached env for /usr/local/bin/python
2023-10-25 10:34:59.575 [debug] Resolved /usr/local/bin/python from cache: {"name":"","location":"","kind":"global-other","executable":{"filename":"/usr/local/bin/python","sysPrefix":"/usr/local","ctime":1697108118683,"mtime":1697074493000},"display":"Python 3.11.6 64-bit","version":{"major":3,"minor":11,"micro":6,"release":{"level":"final","serial":0},"sysVersion":"3.11.6 (main, Oct 12 2023, 01:32:10) [GCC 12.2.0]"},"arch":3,"distro":{"org":""},"source":[],"id":"/usr/local/bin/python","detailedDisplayName":"Python 3.11.6 64-bit"}
2023-10-25 10:34:59.618 [debug] Clearing context for python dependencies not installed: /workspace/v3/src/images/admin.py
2023-10-25 10:35:02.063 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-25 10:35:02.063 [debug] Cached data exists KeyPrefix=Cache_Method_Output_b._selectIfLaunchedViaActivatedEnv-Args=true
2023-10-25 10:35:02.063 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2023-10-25 10:35:02.063 [debug] Found cached env for /usr/local/bin/python
2023-10-25 10:35:02.064 [debug] Found cached env for /usr/local/bin/python
2023-10-25 10:35:02.064 [debug] Resolved /usr/local/bin/python from cache: {"name":"","location":"","kind":"global-other","executable":{"filename":"/usr/local/bin/python","sysPrefix":"/usr/local","ctime":1697108118683,"mtime":1697074493000},"display":"Python 3.11.6 64-bit","version":{"major":3,"minor":11,"micro":6,"release":{"level":"final","serial":0},"sysVersion":"3.11.6 (main, Oct 12 2023, 01:32:10) [GCC 12.2.0]"},"arch":3,"distro":{"org":""},"source":[],"id":"/usr/local/bin/python","detailedDisplayName":"Python 3.11.6 64-bit"}
2023-10-25 10:35:02.064 [debug] Resolved /usr/local/bin/python from cache: {"name":"","location":"","kind":"global-other","executable":{"filename":"/usr/local/bin/python","sysPrefix":"/usr/local","ctime":1697108118683,"mtime":1697074493000},"display":"Python 3.11.6 64-bit","version":{"major":3,"minor":11,"micro":6,"release":{"level":"final","serial":0},"sysVersion":"3.11.6 (main, Oct 12 2023, 01:32:10) [GCC 12.2.0]"},"arch":3,"distro":{"org":""},"source":[],"id":"/usr/local/bin/python","detailedDisplayName":"Python 3.11.6 64-bit"}
2023-10-25 10:35:02.064 [debug] Cached data exists KeyPrefix=Cache_Method_Output_E.ensureEnvironmentContainsPython-Args="/usr/local/bin/python"-Arg-Separator-undefined
2023-10-25 10:35:02.111 [debug] Clearing context for python dependencies not installed: ms-python.python.Python

I don't appear to have "Python Output logs" only the logs for python in the output tab.

@eleanorjboyd
Copy link
Member

Could you include the whole python logs? I am interested in the line where it gives the execution command we send for run. Then this is how to get to the "Python Output logs", its just an option in the dropdown for the output panel.

Thanks!

Screenshot 2023-10-25 at 2 53 58 PM

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Oct 25, 2023
@tazle
Copy link

tazle commented Nov 21, 2023

I'm having some variant of the issue. When not opting out of pythonTestAdapter, python.testing.pytestPath option does not seem to get picked up, and our test suite relied on running the tests through a wrapper script configured in python.testing.pytestPath so that dependencies provisioned through docker-compose are available.

@eleanorjboyd
Copy link
Member

hi @tazle, could you make sure your log level is set to trace then see if you can see this message in your logs "All environment variables set for pytest execution in /Users/eleanorboyd/testingFiles/inc_dec_example workspace: "? You can set your log level through the command palette by going to "developer: set log level". Check to see if the python.testing.pytestPath is in that print out. Mine does contain the pytestPath. (also making sure you are on the newest version of the extension could help)

Copy link

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

Happy Coding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 28, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-testing bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

6 participants