Repository navigation
Python Test uses incorrect python environment #24087
Description
Type: Bug
Behaviour
My tests no longer show up due to a "pytest Discovery Error". I check the output (thanks for the link) and I see that it tries to use my environment, but then it outputs a warning and tries running pytest with the default python installed on the machine!
I can tell it is the default because in an earlier test I saw it was using the C:/Python311
which doesn't have pytest-cov installed. I have pytest-cov installed in my conda environment.
When I run the command it says it is using
python -m pytest --collect-only tests
That command fails when according to the Python Output, but it works just fine if I manually run it in my conda environment. When I manually run the command in the default python env (C:\Python311 or whatever), it has the same error output as the python-tests about not accepting coverage-related input arguments.
I don't know why this suddenly started to break?
The problematic part of the output (as far as I can tell):
2024-09-10 10:23:09.863 [info] > ~\AppData\Local\anaconda3\Scripts\conda.exe run -n Autobot --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\python_files\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.14.0-win32-x64/python_files/printEnvVariables.py
2024-09-10 10:23:09.863 [info] shell: commandPrompt
2024-09-10 10:23:11.575 [info] > pixi --version
2024-09-10 10:23:11.576 [warning] could not find a pixi interpreter for the interpreter at C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-10 10:23:11.584 [info] > python -m pytest -p vscode_pytest --collect-only tests
Is it failing to find pixi and that breaks something that forces it to default to python instead of conda run -n Autobot python?
I tried updating the python extension and pytest, but I get the feeling the issue is in the extension since it is using the wrong python environment.
Steps to reproduce:
- Open the Testing tab
- Refresh tests
- Check the output
Diagnostic data
Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)
2024-09-10 10:21:37.396 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-09-10 10:21:37.396 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-09-10 10:21:37.396 [info] Experiment 'pythonTestAdapter' is active
2024-09-10 10:21:37.396 [info] Native locator: Refresh started
2024-09-10 10:21:37.396 [info] Default formatter is set to ms-python.black-formatter for workspace e:\source\MissionTesting
2024-09-10 10:21:37.396 [error] Following setting is deprecated: "python.linting.pylamaEnabled"
2024-09-10 10:21:37.396 [error] All settings starting with "python.linting." are deprecated and can be removed from settings.
2024-09-10 10:21:37.396 [error] Linting features have been moved to separate linter extensions.
2024-09-10 10:21:37.396 [error] See here for more information: https://code.visualstudio.com/docs/python/linting
2024-09-10 10:21:37.396 [error] Selected linter "pylama" may be supported by extensions like "Ruff", which include several linter rules: https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff
2024-09-10 10:21:37.419 [info] Conda environment manager found at: C:\Users\loganjones\AppData\Local\anaconda3\Scripts\conda.exe
2024-09-10 10:21:37.438 [info] Python interpreter path: ~\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-10 10:21:39.121 [info] > pyenv which python
2024-09-10 10:21:39.121 [info] cwd: .
2024-09-10 10:21:39.188 [info] > conda info --json
2024-09-10 10:21:39.188 [info] shell: powershellCore
2024-09-10 10:21:39.219 [info] > ~\AppData\Local\anaconda3\Scripts\conda.exe info --json
2024-09-10 10:21:41.620 [info] Starting Pylance language server.
2024-09-10 10:21:41.892 [info] Native locator: Refresh finished in 4961 ms
2024-09-10 10:21:50.503 [info] > ~\.conda\Scripts\conda.exe info --json
2024-09-10 10:21:50.503 [info] shell: powershellCore
2024-09-10 10:21:52.852 [info] > ~\.conda\envs\SD-UI\Scripts\conda.exe info --json
2024-09-10 10:21:52.852 [info] shell: powershellCore
2024-09-10 10:21:54.937 [info] > ~\.conda\envs\aigt-processors\Scripts\conda.exe info --json
2024-09-10 10:21:54.937 [info] shell: powershellCore
2024-09-10 10:21:57.024 [info] > ~\AppData\Local\anaconda3\Scripts\conda.exe info --json
2024-09-10 10:21:57.024 [info] shell: powershellCore
2024-09-10 10:22:01.227 [info] > ~\AppData\Local\anaconda3\envs\CV\Scripts\conda.exe info --json
2024-09-10 10:22:01.227 [info] shell: powershellCore
2024-09-10 10:22:03.223 [info] > ~\AppData\Local\anaconda3\envs\Autobot\Scripts\conda.exe info --json
2024-09-10 10:22:03.224 [info] shell: powershellCore
2024-09-10 10:22:05.347 [info] > ~\AppData\Local\anaconda3\envs\GameBuilder\Scripts\conda.exe info --json
2024-09-10 10:22:05.347 [info] shell: powershellCore
2024-09-10 10:22:07.412 [info] > ~/AppData/Local/anaconda3/Scripts/activate ; conda activate Autobot ; echo 'e8b39361-0157-4923-80e1-22d70d46dee6' ; python ~/.vscode/extensions/ms-python.python-2024.14.0-win32-x64/python_files/printEnvVariables.py
2024-09-10 10:22:07.412 [info] shell: powershellCore
2024-09-10 10:22:09.877 [info] > C:\Python311\python.exe ~/.vscode/extensions/ms-python.python-2024.14.0-win32-x64/python_files/printEnvVariables.py
2024-09-10 10:22:09.877 [info] shell: powershellCore
2024-09-10 10:22:12.075 [error] [
'parseEnvironmentOutput, Class name = j, completed in 0ms, has a falsy return value',
SyntaxError: Unexpected token 'L', "Loading cu"... is not valid JSON
at JSON.parse (<anonymous>)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:232183
at j.parseEnvironmentOutput (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:449554)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547377
at j.r.value (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547612)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547377
at j.r.value (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547612)
at j.getProcessEnvironmentVariables (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:446496)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at R._applyCollectionImpl (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:897618)
at R._applyCollection (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:896575)
]
2024-09-10 10:22:12.075 [error] [
'Failed to parse Environment variables, Class name = j, completed in 1ms, has a falsy return value, Arg 1: "Loading custom scripts from: D:\\\\loganjones\\\\OneDrive - Microsoft\\\\Documents\\\\PowerShell\\\\CustomScripts\\r\\n\\r\\n{\\"ALLUSERSPROFILE\\": \\"C:\\\\\\\\ProgramData\\", \\"APPDATA\\": \\"C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Roaming\\", \\"C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\Library\\\\\\\\mingw-w64\\\\\\\\bin;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\Library\\\\\\\\usr\\\\\\\\bin;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\Library\\\\\\\\bin;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\Scripts;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\bin;C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\condabin;C:\\\\\\\\Program Files\\\\\\\\PowerShell\\\\\\\\7;C:\\\\\\\\Program, \\"_CONDA_EXE\\": \\"C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\\\\\\\Scripts\\\\\\\\conda.exe\\", \\"_CONDA_ROOT\\": \\"C:\\\\\\\\Users\\\\\\\\loganjones\\\\\\\\AppData\\\\\\\\Local\\\\\\\\anaconda3\\", \\"__COMPAT_LAYER\\": \\"DetectorsAppHealth HighDpiAware\\", \\"__CONDA_OPENSLL_CERT_FILE_SET\\": \\"1\\", \\"__PSLOCKDOWNPOLICY\\": \\"0\\"}\\r\\n", Arg 2: undefined, Return Value: undefined',
SyntaxError: Unexpected token 'L', "Loading cu"... is not valid JSON
at JSON.parse (<anonymous>)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:232183
at j.parseEnvironmentOutput (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:449554)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547377
at j.r.value (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547612)
at c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547377
at j.r.value (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:547612)
at j.getProcessEnvironmentVariables (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:446496)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at R._applyCollectionImpl (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:897618)
at R._applyCollection (c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\out\client\extension.js:2:896575)
]
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to Autobot {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_EXE in collection to C:\Users\loganjones\AppData\Local\anaconda3\Scripts\conda.exe {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_PREFIX in collection to C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_PREFIX_1 in collection to C:\Users\loganjones\AppData\Local\anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (Autobot) {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_PYTHON_EXE in collection to C:\Users\loganjones\AppData\Local\anaconda3\python.exe {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.078 [info] Prepending environment variable PATH in collection to C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot;C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\Library\mingw-w64\bin;C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\Library\usr\bin;C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\Library\bin;C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\Scripts;C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\bin;C:\Users\loganjones\AppData\Local\anaconda3\condabin; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable PATHEXT in collection to .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW;.CPL {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable PSMODULEPATH in collection to D:\loganjones\OneDrive - Microsoft\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules;C:\Program Files (x86)\Microsoft Azure Information Protection\Powershell {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable PYTHONIOENCODING in collection to utf-8 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable PYTHONPATH in collection to e:\source\MissionTesting {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable PYTHONUNBUFFERED in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable SSL_CERT_FILE in collection to C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\Library\ssl\cacert.pem {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable _CONDA_EXE in collection to C:\Users\loganjones\AppData\Local\anaconda3\Scripts\conda.exe {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable _CONDA_ROOT in collection to C:\Users\loganjones\AppData\Local\anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable __COMPAT_LAYER in collection to DetectorsAppHealth HighDpiAware {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.079 [info] Setting environment variable __CONDA_OPENSLL_CERT_FILE_SET in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-10 10:22:12.080 [info] Send text to terminal: & C:/Python311/python.exe c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\python_files\printEnvVariablesToFile.py c:\Users\loganjones\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\python_files\deactivate\powershell\envVars.txt
2024-09-10 10:23:09.849 [info] Discover tests for workspace name: MissionTesting - uri: e:\source\MissionTesting
2024-09-10 10:23:09.849 [info] Running discovery for pytest using the new test adapter.
2024-09-10 10:23:09.850 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path.
2024-09-10 10:23:09.850 [info] All environment variables set for pytest discovery: {"PYTHONPATH":"c:\\Users\\loganjones\\.vscode\\extensions\\ms-python.python-2024.14.0-win32-x64\\python_files;e:\\source\\MissionTesting","ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\loganjones\\AppData\\Roaming","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\loganjones","LOCALAPPDATA":"C:\\Users\\loganjones\\AppData\\Local","TEST_RUN_PIPE":"\\\\.\\pipe\\python-test-discovery-64879d75d2645a05e212-sock"}
2024-09-10 10:23:09.863 [info] > ~\AppData\Local\anaconda3\Scripts\conda.exe run -n Autobot --no-capture-output python ~\.vscode\extensions\ms-python.python-2024.14.0-win32-x64\python_files\get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.14.0-win32-x64/python_files/printEnvVariables.py
2024-09-10 10:23:09.863 [info] shell: commandPrompt
2024-09-10 10:23:11.575 [info] > pixi --version
2024-09-10 10:23:11.576 [warning] could not find a pixi interpreter for the interpreter at C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-10 10:23:11.584 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-10 10:23:11.584 [info] cwd: .
2024-09-10 10:23:11.979 [error] ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --cov=autobot --cov=common --cov-report=lcov
inifile: e:\source\MissionTesting\pyproject.toml
rootdir: e:\source\MissionTesting
2024-09-10 10:23:12.003 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting.
2024-09-10 10:23:12.003 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting. Creating and sending error discovery payload
2024-09-10 10:23:12.003 [error] pytest test discovery error for workspace: e:\source\MissionTesting
The python test process was terminated before it could exit on its own, the process errored with: Code: 4, Signal: null for workspace e:\source\MissionTesting
Extension version: 2024.14.0
VS Code version: Code 1.93.0 (4849ca9bdf9666755eb463db297b69e5385090e3, 2024-09-04T13:02:38.431Z)
OS version: Windows_NT x64 10.0.22631
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.13
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
- Value of the
python.languageServersetting: Default
User Settings
languageServer: "Pylance"
testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true
Installed Extensions
| Extension Name | Extension Id | Version |
|---|---|---|
| .NET Install Tool | ms-dotnettools.vscode-dotnet-runtime | 2.1.5 |
| ARM Template Viewer | bencoleman.armview | 0.4.6 |
| autoDocstring - Python Docstring Generator | njpwerner.autodocstring | 0.6.1 |
| Azure Account | ms-vscode.azure-account | 0.12.0 |
| Azure CLI Tools | ms-vscode.azurecli | 0.6.0 |
| Azure Functions | ms-azuretools.vscode-azurefunctions | 1.15.3 |
| Azure Pipelines | ms-azure-devops.azure-pipelines | 1.228.0 |
| Azure Resource Manager (ARM) Tools | msazurermtools.azurerm-vscode-tools | 0.15.12 |
| Azure Resources | ms-azuretools.vscode-azureresourcegroups | 0.9.4 |
| Azure Storage | ms-azuretools.vscode-azurestorage | 0.16.1 |
| Azurite | Azurite.azurite | 3.32.0 |
| Better C++ Syntax | jeff-hykin.better-cpp-syntax | 1.27.1 |
| Black Formatter | ms-python.black-formatter | 2024.2.0 |
| C/C++ | ms-vscode.cpptools | 1.22.2 |
| C/C++ Extension Pack | ms-vscode.cpptools-extension-pack | 1.3.0 |
| C/C++ Themes | ms-vscode.cpptools-themes | 2.0.0 |
| C# | ms-dotnettools.csharp | 2.45.20 |
| Code Spell Checker | streetsidesoftware.code-spell-checker | 3.0.1 |
| Coverage Gutters | ryanluker.vscode-coverage-gutters | 2.11.1 |
| Data Wrangler | ms-toolsai.datawrangler | 1.8.0 |
| Dev Containers | ms-vscode-remote.remote-containers | 0.384.0 |
| Docker | ms-azuretools.vscode-docker | 1.29.2 |
| Doxygen Documentation Generator | cschlosser.doxdocgen | 1.4.0 |
| ES7+ React/Redux/React-Native snippets | dsznajder.es7-react-js-snippets | 4.4.3 |
| ESLint | dbaeumer.vscode-eslint | 3.0.10 |
| Even Better TOML | tamasfe.even-better-toml | 0.19.2 |
| Excel Viewer | GrapeCity.gc-excelviewer | 4.2.62 |
| GitHub Copilot | GitHub.copilot | 1.229.0 |
| GitHub Copilot Chat | GitHub.copilot-chat | 0.21.2024090602 |
| GitHub Pull Requests | GitHub.vscode-pull-request-github | 0.96.0 |
| GitLens — Git supercharged | eamodio.gitlens | 15.4.0 |
| GraphQL: Syntax Highlighting | GraphQL.vscode-graphql-syntax | 1.3.6 |
| Graphviz (dot) language support for Visual Studio Code | joaompinto.vscode-graphviz | 0.0.6 |
| Graphviz Interactive Preview | tintinweb.graphviz-interactive-preview | 0.3.5 |
| Hex Editor | ms-vscode.hexeditor | 1.10.0 |
| HTML Preview | tht13.html-preview-vscode | 0.2.5 |
| IntelliCode | VisualStudioExptTeam.vscodeintellicode | 1.3.1 |
| IntelliCode API Usage Examples | VisualStudioExptTeam.intellicode-api-usage-examples | 0.2.8 |
| isort | ms-python.isort | 2023.10.1 |
| JavaScript Debugger | ms-vscode.js-debug | 1.93.0 |
| JavaScript Debugger Companion Extension | ms-vscode.js-debug-companion | 1.1.3 |
| JSON Utility | GanesanChandran.json-utility | 1.0.1 |
| Jupyter | ms-toolsai.jupyter | 2024.8.1 |
| Jupyter Cell Tags | ms-toolsai.vscode-jupyter-cell-tags | 0.1.9 |
| Jupyter Keymap | ms-toolsai.jupyter-keymap | 1.1.2 |
| Jupyter Notebook Renderers | ms-toolsai.jupyter-renderers | 1.0.19 |
| Jupyter Slide Show | ms-toolsai.vscode-jupyter-slideshow | 0.1.6 |
| Live Preview | ms-vscode.live-server | 0.4.14 |
| Markdown All in One | yzhang.markdown-all-in-one | 3.6.2 |
| markdownlint | DavidAnson.vscode-markdownlint | 0.55.0 |
| Material Theme | Equinusocio.vsc-material-theme | 34.5.2 |
| Material Theme Icons — Free | equinusocio.vsc-material-theme-icons | 3.8.8 |
| Microsoft Edge Tools for VS Code | ms-edgedevtools.vscode-edge-devtools | 2.1.5 |
| npm Intellisense | christian-kohler.npm-intellisense | 1.4.5 |
| Phind.com - Chat with your Codebase | phind.phind | 0.25.4 |
| Polyglot Notebooks | ms-dotnettools.dotnet-interactive-vscode | 1.0.5229040 |
| PowerShell | ms-vscode.powershell | 2024.2.2 |
| Prettier - Code formatter | esbenp.prettier-vscode | 11.0.0 |
| Protobuf support | peterj.proto | 0.0.4 |
| Pylance | ms-python.vscode-pylance | 2024.9.1 |
| Python | ms-python.python | 2024.14.0 |
| Python Debugger | ms-python.debugpy | 2024.10.0 |
| React Native Tools | msjsdiag.vscode-react-native | 1.13.0 |
| Serial Monitor | ms-vscode.vscode-serial-monitor | 0.12.0 |
| Simple React Snippets | burkeholland.simple-react-snippets | 1.2.8 |
| Table Visualizer for JavaScript Profiles | ms-vscode.vscode-js-profile-table | 1.0.9 |
| Todo Tree | Gruntfuggly.todo-tree | 0.0.226 |
| Unreal Engine Python | NilsSoderman.ue-python | 1.4.1 |
| VS Code Speech | ms-vscode.vscode-speech | 0.10.0 |
| Word Count | ms-vscode.wordcount | 0.1.0 |
| WSL | ms-vscode-remote.remote-wsl | 0.88.2 |
| XML Format | mikeburgh.xml-format | 1.1.3 |
| YAML | redhat.vscode-yaml | 1.15.0 |
| YAML ❤️ JSON | hilleer.yaml-plus-json | 1.12.2 |
| yarn | gamunu.vscode-yarn | 2.1.0 |
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i9-10900 CPU @ 2.80GHz (20 x 2808) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: enabled_on 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 skia_graphite: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 63.71GB (23.96GB free) |
| Process Argv | --crash-reporter-id 82edcc25-c4c8-4994-be5c-0197222c8a32 |
| Screen Reader | no |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
724cj586:31013169
a69g1124:31058053
dvdeprecation:31068756
dwnewjupyter:31046869
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl2:31134655
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
nativeloc1:31134641
wkspc-ranged-t:31125599
3ad50483:31134767
autoexpandse:31133494
fje88620:31121564
Activity
eleanorjboyd commentedon Sep 11, 2024
Hi! I am seeing an error arise before you get the the actual testing. This error:
Can you check any environment variables you are putting in? Through a .env file, vscode settings or otherwise. It seems like it can't parse something and that is why it cannot start up the environment to then run tests
logar16 commentedon Sep 11, 2024
Good catch, but unfortunately, that issue (I was printing out something in my Powershell profile on Powershell startup that it was trying to parse in addition to env variables) does not seem related. I fixed it and restarted VS code and even my machine and I still get the same issue where it appears to be using the default
pythonfor the system instead of the environment for the workspace. I include the whole thing again just to show that it doesn't error anymore, but I assume the issue is still more related to the last several lines?I can see in there that the env seems to be setup right:
Autobotis my conda env name. I'm just not sure why it doesn't consistently use it?Actually, I don't think it is using it for test discovery (seems to be using just the normal path or something?):
logar16 commentedon Sep 11, 2024
I turned on the
Debuglevel logging and got a little more detail:I could be reading it wrong, but it seems like it is assuming that when it runs
pythonit will use the workspace environment, but that is not what is happening:If that were the case a simple fix to prepend
conda run -n Autobotwould work. And it seems here, you already know what the env name is, so it shouldn't be too hard?Even if you don't plan to do that for priority reasons, where is this code (that runs
python -m pytest) so I can modify it on my side or something? Not having unit tests in the IDE is kind of killing my workflow...logar16 commentedon Sep 11, 2024
And for confirmation it is using the system default python, I removed the
--covand similar coverage commands from thepyproject.tomlso pytest was able to start but then (understandably) ran into issues immediately after that and the stacktrace shows it is using theC:\Python311:leiterrl commentedon Sep 12, 2024
I believe I am facing the same problem. However, it does not occur anymore when I switch the
python.locatoroption from 'native' to 'js'. Maybe you can give this a try as well to narrow down the issue?logar16 commentedon Sep 12, 2024
That did it! Test collection and execution are back to working like normal.
Thank you Raphael Leiteritz (@leiterrl)! I never would have thought to try that.
Eleanor Boyd (@eleanorjboyd) the above solved my issue, but it would be interesting to know if there is a plan to make it so
python.locator = nativeworks more reliably since that is the default option.sjdemartini commentedon Sep 12, 2024
I have the same problem as the above, and adding
"python.locator": "js"to my settings (and restarting VSCode) also resolved the issue for me.My selected python interpreter in VSCode in my workspace is (and has been for multiple years) a conda environment, but I noticed as of today that VSCode's test runner seemed to be using a
.pyenvpython interpreter/path instead, which in my case ran into problems upon initial load with test discovery since pytest itself wasn't installed for that python env:vmatekole commentedon Sep 16, 2024
I had the same issue — I believe it (python.locator) was changed after an update to vsstudio.
eleanorjboyd commentedon Sep 16, 2024
Karthik Nadig (@karthiknadig) any ideas about the correlation between the native locator stuff?
karthiknadig commentedon Sep 16, 2024
Eleanor Boyd (@eleanorjboyd) Not really sure why this is happening. We can look at the API and see if there is a difference is why it misses selecting the expected repo. We might need a repro for this to diagnose further.
sfc-gh-melnacouzi commentedon Sep 20, 2024
It seems that it's taking a prefix that has
bin/pythonin it (example: /opt/homebrew/Caskroom/miniconda/base/envs/testtest/bin/python), and then appendingbin/pythonto it again, and because of this, it switches back to default python env.Prioritize `conda` handler over `pixi` handler (#24198)
leiterrl commentedon Oct 7, 2024
I just tested v2024.16.0 and the problem still persists for me. Unfortunately my work machine is pretty locked down so I can't share logs easily. Logan Jones (@logar16) maybe you can also check it on your side?
github-actions commentedon Nov 6, 2024
Hey Eleanor Boyd (@eleanorjboyd), this issue might need further attention.
Logan Jones (@logar16), you can help us out by closing this issue if the problem no longer exists, or adding more information.
github-actions commentedon Dec 8, 2024
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!