Repository navigation
Closed
Labels
area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team
Description
Issue Type: Bug
Steps to reproduce:
-Click on test beker
-Test discovery fails with "Error discovering pytest tests (see Output > Python)"
-In "Output", the following error is reported:
conda run -n insolinsights --no-capture-output python ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.8.0\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir . -s --cache-clear
cwd: .
[ERROR 2022-5-11 18:53:8.626]: Error discovering pytest tests:
[n [Error]: & was unexpected at this time.
at ChildProcess.<anonymous> (c:\Users\mathi\.vscode\extensions\ms-python.python-2022.8.0\out\client\extension.js:2:232793)
at Object.onceWrapper (node:events:510:26)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)]
The same error occurs every time I save a Python file (as the test discovery runs automatically).
Pytest works fine when called directly from the terminal. Only the test explorer creates this error.
Expected output:
-Tests are correctly discovered
Extension version: 2022.8.0
VS Code version: Code 1.68.0 (4af164ea3a06f701fe3e89a2bcbb421d2026b68f, 2022-06-08T11:44:16.822Z)
OS version: Windows_NT x64 10.0.22000
Restricted Mode: No
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz (8 x 1498) |
| 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 oop_rasterization: enabled opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 15.60GB (7.01GB free) |
| Process Argv | --crash-reporter-id 94bd11a9-8495-4db7-8f23-e7f7ed5117ac |
| Screen Reader | no |
| VM | 0% |
Metadata
Metadata
Labels
area-testingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team
Activity
karthiknadig commentedon Jun 13, 2022
Mathieu Ackermann (@mathieuackermann) Can you share details about the tests that you are running? Is there by chance any particular test with
&in its parameters?mathieuackermann commentedon Jun 13, 2022
Karthik Nadig (@karthiknadig) no, I'm not using this character in any of the tests. Besides, all the tests are correctly discovered and run without issue if I run
pytestdirectly from the terminal from the root of the workspace.I'm not passing any parameter to pytest either. My only workspace settings are:
{ "python.testing.pytestEnabled": true, "python.testing.autoTestDiscoverOnSaveEnabled": false }karthiknadig commentedon Jun 13, 2022
Mathieu Ackermann (@mathieuackermann) Can you run this from the terminal and share the output?
mathieuackermann commentedon Jun 13, 2022
Karthik Nadig (@karthiknadig) here is the output:
karthiknadig commentedon Jun 13, 2022
Sorry, that
pytestnot found is due to a conda bug when double activation occurs due toconda runin an already activated terminal.Can you try with this:
mathieuackermann commentedon Jun 14, 2022
Thanks! This latest command ran without error and produced a lot of output, listing all the tests in the terminal in JSON format. However the tests are still not displayed in the test explorer. How can I workaround that bug?
karthiknadig commentedon Jun 14, 2022
Mathieu Ackermann (@mathieuackermann) Can you share the output? something there must be causing this to happen.
mathieuackermann commentedon Jun 14, 2022
The output goes beyond the cache limit of the terminal, as there are many test combinations. Below is just a sample:
{"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MED-Stats.MIN-15]", "name": "test_israining_notraining[1-Stats.MED-Stats.MIN-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MED-Stats.MIN-60]", "name": "test_israining_notraining[1-Stats.MED-Stats.MIN-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MED-Stats.MAX-15]", "name": "test_israining_notraining[1-Stats.MED-Stats.MAX-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MED-Stats.MAX-60]", "name": "test_israining_notraining[1-Stats.MED-Stats.MAX-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.AVG-15]", "name": "test_israining_notraining[1-Stats.MIN-Stats.AVG-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.AVG-60]", "name": "test_israining_notraining[1-Stats.MIN-Stats.AVG-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MED-15]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MED-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MED-60]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MED-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MIN-15]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MIN-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MIN-60]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MIN-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MAX-15]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MAX-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MIN-Stats.MAX-60]", "name": "test_israining_notraining[1-Stats.MIN-Stats.MAX-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.AVG-15]", "name": "test_israining_notraining[1-Stats.MAX-Stats.AVG-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.AVG-60]", "name": "test_israining_notraining[1-Stats.MAX-Stats.AVG-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MED-15]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MED-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MED-60]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MED-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MIN-15]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MIN-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MIN-60]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MIN-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MAX-15]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MAX-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[1-Stats.MAX-Stats.MAX-60]", "name": "test_israining_notraining[1-Stats.MAX-Stats.MAX-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.AVG-15]", "name": "test_israining_notraining[2-Stats.AVG-Stats.AVG-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.AVG-60]", "name": "test_israining_notraining[2-Stats.AVG-Stats.AVG-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MED-15]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MED-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MED-60]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MED-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MIN-15]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MIN-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MIN-60]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MIN-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MAX-15]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MAX-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.AVG-Stats.MAX-60]", "name": "test_israining_notraining[2-Stats.AVG-Stats.MAX-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.MED-Stats.AVG-15]", "name": "test_israining_notraining[2-Stats.MED-Stats.AVG-15]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining[2-Stats.MED-Stats.AVG-60]", "name": "test_israining_notraining[2-Stats.MED-Stats.AVG-60]", "source": ".\\tests\\sensor_analyzer_test.py:201", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_notraining"}, {"id": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_raining[3-Stats.MAX-Stats.MAX-60]", "name": "test_israining_raining[3-Stats.MAX-Stats.MAX-60]", "source": ".\\tests\\sensor_analyzer_test.py:229", "markers": [], "parentid": "./tests/sensor_analyzer_test.py::TestSensorAnalyzer::test_israining_raining"}]}]karthiknadig commentedon Jun 14, 2022
I see, try this, it should put the content into a file.
Please share the file pytestdata.json.
mathieuackermann commentedon Jun 14, 2022
Here it is (added .txt because GitHub refused to upload .json)
pytestdata.json.txt
karthiknadig commentedon Jun 14, 2022
Mathieu Ackermann (@mathieuackermann) Thanks for the data file. I looks fine, so I think the problem is elsewhere.
Kartik Raj (@karrtikr) It seems like we are probably not using the right command here to invoke python. I suspect that we are using Powershell style command for something that is running on cmd? I will need your input on this.
ehawman commentedon Jun 24, 2022
Karthik Nadig (@karthiknadig) I'm experiencing something similar. With Nushell, a new terminal instance tries to activate the selected venv with

& c:/Users/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/Activate.ps1The correct command here should be
source c:/Users/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/activate.nuWeirdly, when actually using pwsh it truncates the activation command:

sers/ehawman/Documents/Programming/Python/PA-FindReplace/.venv/Scripts/Activate.ps1, causing it to fail.Do you think this falls under the same umbrella or should I start a new issue?
karthiknadig commentedon Jun 24, 2022
Evan Hawman (@ehawman) Kartik Raj (@karrtikr) I don't think we detect Nushell, that would be a feature request.
ehawman commentedon Jun 24, 2022
Karthik Nadig (@karthiknadig) gotcha. thanks.
mathieuackermann commentedon Jul 13, 2022
Issue solved. For some reason, I had an obscure registry entry causing a crash of cmd.exe on startup, as described on this link: https://stackoverflow.com/questions/58849884/cmd-exe-closes-immediately-unusual-line-in-autorun-registry-entry
So the issue was not related to VS code or the Python extension.