vscode-python: pytest run shows no output, gets in connection error infinite loop

Note this is a bug report, but the built-in dialog for bug reports was broken.

Behaviour

Expected vs. Actual

Tests used to run when I clicked the play button in the test explorer but sometime within the last few weeks the whole integration broke.

Steps to reproduce:

  1. Trigger a pytest run in the test explorer

https://github.com/microsoft/vscode-python/assets/1060436/7cfc9f2e-2cf2-4a93-821f-0ffc8196c2a4

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.11.0
  • 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 (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

User Settings

languageServer: "Pylance"
  "python.testing.cwd": "./server",
  "python.testing.pytestArgs": [
    "-p",
    "no:cov",
    "-p",
    "no:ddtrace",
    "-p",
    "no:ddtrace.pytest_bdd",
    "-p",
    "no:xdist"
  ],
  "python.testing.unittestEnabled": false,
  "python.testing.pytestEnabled": true,

A/B test info

vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
pythonvs932:30410667
py29gd2263:30856252
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
f6dab269:30613381
showlangstatbar:30737416
962ge761:30841074
03d35959:30757346
57b77579:30736110
pythonfmttext:30731395
fixshowwlkth:30771522
showindicator:30805244
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30797651
pythonidxpt:30805730
pythonnoceb:30805159
copilotsettingc:30839828
dsvsc013:30795093
dsvsc014:30804076
diffeditorv1:30821571
dsvsc015:30845448

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Reactions: 3
  • Comments: 31 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Indeed. I can also confirm, that the current pre-release version is working as expected. Thanks! 💯

I can confirm the fix works on my machine. Thank you!

Another engineer on our team also ran into this, earlier this morning and adding "python.experiments.optOutFrom": ["pythonTestAdapter"] worked like it did before.

I’m not sure how to help test because we’re not directly modifying the os.environ but it’s possible I’m doing that accidentally and have no idea. Let me know if I can help test though would be glad to.

Aha! Great catch! Yes, that would be the reason. To confirm you are able to edit the test to still test what you desire for your use case and not edit environment variables right? I am going to go in and add some extra guardrails to help surface this issue to users and stop the infinite return of the payload.

One follow-up, were you seeing the extension crash as a result or would you force crash it to stop it? Wondering if this error led to an overload that caused the extension to crash.