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

Python Test uses incorrect python environment #24087

Open
logar16 opened this issue Sep 10, 2024 · 11 comments
Open

Python Test uses incorrect python environment #24087

logar16 opened this issue Sep 10, 2024 · 11 comments
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@logar16
Copy link

logar16 commented Sep 10, 2024

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:

  1. Open the Testing tab
  2. Refresh tests
  3. Check the output

Diagnostic data

Output for Python in the Output panel (ViewOutput, 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.languageServer setting: 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

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 10, 2024
@eleanorjboyd
Copy link
Member

Hi! I am seeing an error arise before you get the the actual testing. This 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

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

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 11, 2024
@logar16
Copy link
Author

logar16 commented 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 python for 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: Autobot is my conda env name. I'm just not sure why it doesn't consistently use it?

2024-09-11 12:12:22.367 [info] Prepending environment variable PATH in collection to C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot; ...

Actually, I don't think it is using it for test discovery (seems to be using just the normal path or something?):

2024-09-11 12:13:23.258 [info] All environment variables set for pytest discovery: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\loganjones\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_18936_CRWVZVSVPOVKTYZX","COMPUTERNAME":"THINKSTATION-LO","EFC_13476":"1","ELECTRON_RUN_AS_NODE":"1","FPS_BROWSER_APP_PROFILE_STRING":"Internet Explorer","FPS_BROWSER_USER_PROFILE_STRING":"Default","GIT_LFS_PATH":"C:\\Program Files\\Git LFS","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\loganjones","LOCALAPPDATA":"C:\\Users\\loganjones\\AppData\\Local","LOGONSERVER":"\\\\THINKSTATION-LO","NUMBER_OF_PROCESSORS":"20","OLLAMA_MODELS":"E:\\Logan\\source\\LLMs\\ollama\\models","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW","POWERSHELL_DISTRIBUTION_CHANNEL":"MSI:Windows 10 Enterprise","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 165 Stepping 5, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"a505","PUBLIC":"C:\\Users\\Public","SESSIONNAME":"Console","TEMP":"C:\\Users\\LOGANJ~1\\AppData\\Local\\Temp","TMP":"C:\\Users\\LOGANJ~1\\AppData\\Local\\Temp","UATDATA":"C:\\WINDOWS\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77","USERDNSDOMAIN":"northamerica.corp.microsoft.com","USERDOMAIN":"NORTHAMERICA","USERDOMAIN_ROAMINGPROFILE":"NORTHAMERICA","USERNAME":"loganjones","USERPROFILE":"C:\\Users\\loganjones","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"C:\\Users\\loganjones\\AppData\\Roaming\\Code\\CachedData\\4849ca9bdf9666755eb463db297b69e5385090e3","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\WINDOWS\\system32","VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME":"undefined","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\22a38d4b-1.93.0-main-sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"C:\\\\Users\\\\loganjones\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\resources\\\\app\\\\out\\\\nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"18936","ZES_ENABLE_SYSMAN":"1","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ChocolateyLastPathUpdate":"132876180735061241","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","Env_GeneratedVersion":"0.1.22139.24290","OneDrive":"D:\\loganjones\\OneDrive - Microsoft","OneDriveCommercial":"D:\\loganjones\\OneDrive - Microsoft","OneDriveConsumer":"E:\\Logan\\OneDrive","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\Microsoft Azure Information Protection\\Powershell","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SystemDrive":"C:","SystemRoot":"C:\\WINDOWS","__PSLockDownPolicy":"0","windir":"C:\\WINDOWS","Path":"C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\java8path;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Python311\\Scripts\\;C:\\Python311\\;C:\\Python310\\Scripts\\;C:\\Python310\\;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;D:\\Program Files\\Graphviz\\bin;C:\\Program Files\\Microsoft\\Web Platform Installer\\;C:\\Program Files\\Git LFS;D:\\ffmpeg\\bin\\;D:\\Program Files\\GitHub CLI\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;D:\\Program Files\\nodejs\\;C:\\Program Files\\Microsoft\\Azure Functions Core Tools\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Docker\\Docker\\resources\\bin;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\\scoop\\apps\\latex\\current\\texmfs\\install\\miktex\\bin\\x64;C:\\Users\\loganjones\\scoop\\shims;C:\\Users\\loganjones\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;D:\\Program Files\\Graphviz\\bin;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\GitHubDesktop\\bin;C:\\Program Files (x86)\\Nmap;C:\\Users\\loganjones\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\loganjones\\AppData\\Roaming\\npm;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\Programs\\Ollama;","PYTHONPATH":"c:\\Users\\loganjones\\.vscode\\extensions\\ms-python.python-2024.14.0-win32-x64\\python_files","TEST_RUN_PIPE":"\\\\.\\pipe\\python-test-discovery-3c3f73bfeb452b366820-sock"}

024-09-11 12:12:04.732 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-09-11 12:12:04.733 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-09-11 12:12:04.733 [info] Experiment 'pythonTestAdapter' is active
2024-09-11 12:12:04.733 [info] Native locator: Refresh started
2024-09-11 12:12:04.733 [info] Default formatter is set to ms-python.black-formatter for workspace e:\source\MissionTesting
2024-09-11 12:12:04.747 [info] Conda environment manager found at: C:\Users\loganjones\AppData\Local\anaconda3\Scripts\conda.exe
2024-09-11 12:12:04.841 [info] Python interpreter path: ~\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-11 12:12:05.204 [info] > pyenv which python
2024-09-11 12:12:05.204 [info] cwd: .
2024-09-11 12:12:08.224 [info] > conda info --json
2024-09-11 12:12:08.225 [info] shell: powershellCore
2024-09-11 12:12:08.607 [info] Native locator: Refresh finished in 4051 ms
2024-09-11 12:12:15.778 [info] > conda 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-11 12:12:15.778 [info] shell: powershellCore
2024-09-11 12:12:15.873 [info] Starting Pylance language server.
2024-09-11 12:12:19.920 [info] > C:\Python311\python.exe ~/.vscode/extensions/ms-python.python-2024.14.0-win32-x64/python_files/printEnvVariables.py
2024-09-11 12:12:19.921 [info] shell: powershellCore
2024-09-11 12:12:22.366 [info] Setting environment variable APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL in collection to 1 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.366 [info] Setting environment variable CONDA_DEFAULT_ENV in collection to Autobot {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.366 [info] Setting environment variable CONDA_PREFIX in collection to C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.366 [info] Setting environment variable CONDA_PREFIX_1 in collection to C:\Users\loganjones\AppData\Local\anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.366 [info] Setting environment variable CONDA_PROMPT_MODIFIER in collection to (Autobot)  {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [info] Setting environment variable CONDA_SHLVL in collection to 2 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [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;C:\Program Files\PowerShell\7;C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Python311\Scripts;C:\Python311;C:\Python310\Scripts;C:\Python310;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files\Microsoft SQL Server\150\Tools\Binn;D:\Program Files\Graphviz\bin;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Git LFS;D:\ffmpeg\bin;D:\Program Files\GitHub CLI;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Program Files\nodejs;C:\Program Files\Microsoft\Azure Functions Core Tools;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Git\cmd;C:\Program Files\PowerShell\7;C:\Program Files\Docker\Docker\resources\bin;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\scoop\apps\latex\current\texmfs\install\miktex\bin\x64;C:\Users\loganjones\scoop\shims;C:\Users\loganjones\AppData\Local\Microsoft\WindowsApps;C:\Users\loganjones\.dotnet\tools;C:\Users\loganjones\AppData\Local\Programs\Microsoft VS Code\bin;D:\Program Files\Graphviz\bin;C:\Users\loganjones\.dotnet\tools;C:\Users\loganjones\AppData\Local\GitHubDesktop\bin;C:\Program Files (x86)\Nmap;C:\Users\loganjones\AppData\Local\Microsoft\WindowsApps;C:\Users\loganjones\AppData\Roaming\npm;C:\Users\loganjones\.dotnet\tools;C:\Users\loganjones\AppData\Local\Programs\Ollama;.; {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [info] Setting environment variable PROMPT in collection to (Autobot) $P$G {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [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-11 12:12:22.367 [info] Setting environment variable _CONDA_OLD_CHCP in collection to 437 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [info] Setting environment variable __CONDA_OPENSLL_CERT_FILE_SET in collection to "1" {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.367 [info] Setting environment variable CONDA_ROOT in collection to C:\Users\loganjones\AppData\Local\anaconda3 {"applyAtShellIntegration":true,"applyAtProcessCreation":true}
2024-09-11 12:12:22.368 [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-11 12:13:23.256 [info] Discover tests for workspace name: MissionTesting - uri: e:\source\MissionTesting
2024-09-11 12:13:23.256 [info] Running discovery for pytest using the new test adapter.
2024-09-11 12:13:23.258 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path.
2024-09-11 12:13:23.258 [info] All environment variables set for pytest discovery: {"ALLUSERSPROFILE":"C:\\ProgramData","APPDATA":"C:\\Users\\loganjones\\AppData\\Roaming","APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL":"1","CHROME_CRASHPAD_PIPE_NAME":"\\\\.\\pipe\\crashpad_18936_CRWVZVSVPOVKTYZX","COMPUTERNAME":"THINKSTATION-LO","EFC_13476":"1","ELECTRON_RUN_AS_NODE":"1","FPS_BROWSER_APP_PROFILE_STRING":"Internet Explorer","FPS_BROWSER_USER_PROFILE_STRING":"Default","GIT_LFS_PATH":"C:\\Program Files\\Git LFS","HOMEDRIVE":"C:","HOMEPATH":"\\Users\\loganjones","LOCALAPPDATA":"C:\\Users\\loganjones\\AppData\\Local","LOGONSERVER":"\\\\THINKSTATION-LO","NUMBER_OF_PROCESSORS":"20","OLLAMA_MODELS":"E:\\Logan\\source\\LLMs\\ollama\\models","ORIGINAL_XDG_CURRENT_DESKTOP":"undefined","OS":"Windows_NT","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW","POWERSHELL_DISTRIBUTION_CHANNEL":"MSI:Windows 10 Enterprise","PROCESSOR_ARCHITECTURE":"AMD64","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 165 Stepping 5, GenuineIntel","PROCESSOR_LEVEL":"6","PROCESSOR_REVISION":"a505","PUBLIC":"C:\\Users\\Public","SESSIONNAME":"Console","TEMP":"C:\\Users\\LOGANJ~1\\AppData\\Local\\Temp","TMP":"C:\\Users\\LOGANJ~1\\AppData\\Local\\Temp","UATDATA":"C:\\WINDOWS\\CCM\\UATData\\D9F8C395-CAB8-491d-B8AC-179A1FE1BE77","USERDNSDOMAIN":"northamerica.corp.microsoft.com","USERDOMAIN":"NORTHAMERICA","USERDOMAIN_ROAMINGPROFILE":"NORTHAMERICA","USERNAME":"loganjones","USERPROFILE":"C:\\Users\\loganjones","VSCODE_AMD_ENTRYPOINT":"vs/workbench/api/node/extensionHostProcess","VSCODE_CODE_CACHE_PATH":"C:\\Users\\loganjones\\AppData\\Roaming\\Code\\CachedData\\4849ca9bdf9666755eb463db297b69e5385090e3","VSCODE_CRASH_REPORTER_PROCESS_TYPE":"extensionHost","VSCODE_CWD":"C:\\WINDOWS\\system32","VSCODE_DOTNET_INSTALL_TOOL_ORIGINAL_HOME":"undefined","VSCODE_HANDLES_UNCAUGHT_ERRORS":"true","VSCODE_IPC_HOOK":"\\\\.\\pipe\\22a38d4b-1.93.0-main-sock","VSCODE_NLS_CONFIG":"{\"userLocale\":\"en-us\",\"osLocale\":\"en-us\",\"resolvedLanguage\":\"en\",\"defaultMessagesFile\":\"C:\\\\Users\\\\loganjones\\\\AppData\\\\Local\\\\Programs\\\\Microsoft VS Code\\\\resources\\\\app\\\\out\\\\nls.messages.json\",\"locale\":\"en-us\",\"availableLanguages\":{}}","VSCODE_PID":"18936","ZES_ENABLE_SYSMAN":"1","ChocolateyInstall":"C:\\ProgramData\\chocolatey","ChocolateyLastPathUpdate":"132876180735061241","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","CommonProgramFiles":"C:\\Program Files\\Common Files","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","CommonProgramW6432":"C:\\Program Files\\Common Files","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","Env_GeneratedVersion":"0.1.22139.24290","OneDrive":"D:\\loganjones\\OneDrive - Microsoft","OneDriveCommercial":"D:\\loganjones\\OneDrive - Microsoft","OneDriveConsumer":"E:\\Logan\\OneDrive","PSModulePath":"C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files (x86)\\Microsoft Azure Information Protection\\Powershell","ProgramData":"C:\\ProgramData","ProgramFiles":"C:\\Program Files","ProgramFiles(x86)":"C:\\Program Files (x86)","ProgramW6432":"C:\\Program Files","SystemDrive":"C:","SystemRoot":"C:\\WINDOWS","__PSLockDownPolicy":"0","windir":"C:\\WINDOWS","Path":"C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\java8path;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\Python311\\Scripts\\;C:\\Python311\\;C:\\Python310\\Scripts\\;C:\\Python310\\;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\dotnet\\;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\150\\Tools\\Binn\\;D:\\Program Files\\Graphviz\\bin;C:\\Program Files\\Microsoft\\Web Platform Installer\\;C:\\Program Files\\Git LFS;D:\\ffmpeg\\bin\\;D:\\Program Files\\GitHub CLI\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;D:\\Program Files\\nodejs\\;C:\\Program Files\\Microsoft\\Azure Functions Core Tools\\;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PowerShell\\7\\;C:\\Program Files\\Docker\\Docker\\resources\\bin;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\\scoop\\apps\\latex\\current\\texmfs\\install\\miktex\\bin\\x64;C:\\Users\\loganjones\\scoop\\shims;C:\\Users\\loganjones\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;D:\\Program Files\\Graphviz\\bin;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\GitHubDesktop\\bin;C:\\Program Files (x86)\\Nmap;C:\\Users\\loganjones\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\loganjones\\AppData\\Roaming\\npm;C:\\Users\\loganjones\\.dotnet\\tools;C:\\Users\\loganjones\\AppData\\Local\\Programs\\Ollama;","PYTHONPATH":"c:\\Users\\loganjones\\.vscode\\extensions\\ms-python.python-2024.14.0-win32-x64\\python_files","TEST_RUN_PIPE":"\\\\.\\pipe\\python-test-discovery-3c3f73bfeb452b366820-sock"}
2024-09-11 12:13:23.270 [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-11 12:13:23.270 [info] shell: commandPrompt
2024-09-11 12:13:24.871 [info] > pixi --version
2024-09-11 12:13:24.872 [warning] could not find a pixi interpreter for the interpreter at C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-11 12:13:24.880 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-11 12:13:24.880 [info] cwd: .
2024-09-11 12:13:25.437 [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-11 12:13:25.463 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting.
2024-09-11 12:13:25.463 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting. Creating and sending error discovery payload
2024-09-11 12:13:25.463 [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

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 11, 2024
@logar16
Copy link
Author

logar16 commented Sep 11, 2024

I turned on the Debug level logging and got a little more detail:

2024-09-11 13:32:21.424 [debug] Testing: Manually triggered test refresh
2024-09-11 13:32:21.425 [debug] Testing: Clearing all discovered tests
2024-09-11 13:32:21.425 [debug] Testing: Forcing test data refresh
2024-09-11 13:32:21.425 [debug] Testing: Refreshing all test data
2024-09-11 13:32:21.426 [debug] Python API env change detected C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\python.exe update
2024-09-11 13:32:21.427 [info] Discover tests for workspace name: MissionTesting - uri: e:\source\MissionTesting
2024-09-11 13:32:21.427 [info] Running discovery for pytest using the new test adapter.
2024-09-11 13:32:21.427 [debug] Starting Test Discovery named pipe
2024-09-11 13:32:21.427 [debug] Creating named pipe server on \\.\pipe\python-test-discovery-4cb861741fb10d23b583-sock
2024-09-11 13:32:21.428 [warning] The cwd resolves to a different path, checking if it has a symbolic link somewhere in its path.
2024-09-11 13:32:21.428 [info] All environment variables set for pytest discovery: { *SEE PREVIOUS COMMENTS FOR ENV VARS* }
2024-09-11 13:32:21.428 [warning] could not find a pixi interpreter for the interpreter at C:\Users\loganjones\AppData\Local\anaconda3\envs\Autobot\python.exe
2024-09-11 13:32:21.429 [debug] Executable does not exist within conda env, assume the executable to be `python` {"name":"Autobot","prefix":"C:\\Users\\loganjones\\AppData\\Local\\anaconda3\\envs\\Autobot\\python.exe"}
2024-09-11 13:32:21.435 [debug] Running pytest discovery with command: -m pytest -p vscode_pytest --collect-only tests for workspace e:\source\MissionTesting.
2024-09-11 13:32:21.435 [info] > python -m pytest -p vscode_pytest --collect-only tests
2024-09-11 13:32:21.435 [info] cwd: .
2024-09-11 13:32:21.799 [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-11 13:32:21.819 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting.
2024-09-11 13:32:21.819 [error] Subprocess exited unsuccessfully with exit code 4 and signal null on workspace e:\source\MissionTesting. Creating and sending error discovery payload
2024-09-11 13:32:21.819 [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
2024-09-11 13:32:21.819 [debug] deferredTill EOT resolved

I could be reading it wrong, but it seems like it is assuming that when it runs python it will use the workspace environment, but that is not what is happening:

[debug] Executable does not exist within conda env, assume the executable to be `python` {"name":"Autobot","prefix":"C:\\Users\\loganjones\\AppData\\Local\\anaconda3\\envs\\Autobot\\python.exe"}
2024-09-11 13:32:21.435 [debug] Running pytest discovery with command: -m pytest -p vscode_pytest --collect-only tests for workspace e:\source\MissionTesting.
2024-09-11 13:32:21.435 [info] > python -m pytest -p vscode_pytest --collect-only tests

If that were the case a simple fix to prepend conda run -n Autobot would 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
Copy link
Author

logar16 commented Sep 11, 2024

And for confirmation it is using the system default python, I removed the --cov and similar coverage commands from the pyproject.toml so pytest was able to start but then (understandably) ran into issues immediately after that and the stacktrace shows it is using the C:\Python311:

2024-09-11 13:49:30.368 [error] pytest test discovery error for workspace:  e:\source\MissionTesting 
 _pytest.nodes.Collector.CollectError: ImportError while importing test module 'e:\source\MissionTesting\tests\autobot\behaviors\test_actor_behaviors.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
C:\Python311\Lib\importlib\__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests\autobot\behaviors\test_actor_behaviors.py:5: in <module>
    from autobot.behaviors import (
autobot\behaviors.py:9: in <module>

@leiterrl
Copy link

I believe I am facing the same problem. However, it does not occur anymore when I switch the python.locator option from 'native' to 'js'. Maybe you can give this a try as well to narrow down the issue?

@logar16
Copy link
Author

logar16 commented Sep 12, 2024

I believe I am facing the same problem. However, it does not occur anymore when I switch the python.locator option from 'native' to 'js'. Maybe you can give this a try as well to narrow down the issue?

That did it! Test collection and execution are back to working like normal.

Thank you @leiterrl! I never would have thought to try that.

@eleanorjboyd the above solved my issue, but it would be interesting to know if there is a plan to make it so python.locator = native works more reliably since that is the default option.

@sjdemartini
Copy link

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 .pyenv python 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:

2024-09-12 16:57:10.589 [error] /Users/sdemartini/.pyenv/versions/3.10.5/bin/python: No module named pytest

2024-09-12 16:57:10.594 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/sdemartini/my_project.
2024-09-12 16:57:10.594 [error] Subprocess exited unsuccessfully with exit code 1 and signal null on workspace /Users/sdemartini/my_project. Creating and sending error discovery payload
2024-09-12 16:57:10.594 [error] pytest test discovery error for workspace:  /Users/sdemartini/my_project 
  
 The python test process was terminated before it could exit on its own, the process errored with: Code: 1, Signal: null for workspace /Users/sdemartini/my_project

@vmatekole
Copy link

I had the same issue — I believe it (python.locator) was changed after an update to vsstudio.

@eleanorjboyd
Copy link
Member

@karthiknadig any ideas about the correlation between the native locator stuff?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 16, 2024
@karthiknadig
Copy link
Member

@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
Copy link

sfc-gh-melnacouzi commented Sep 20, 2024

It seems that it's taking a prefix that has bin/python in it (example: /opt/homebrew/Caskroom/miniconda/base/envs/testtest/bin/python), and then appending bin/python to it again, and because of this, it switches back to default python env.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

7 participants