microsoft / microsoft/vscode-python-debugger

Conda environment initialized differently when executing vs debugging unit tests

Open
#736 3 comments 0 reactions 1 assignee View on GitHub

@eleanorjboyd is already working on this.

Since Jun 30, 2025.

triage-needed
Dominant language
TypeScript
Stars
180
Forks
126
Avg merge
2d 3h
Merged PRs (30d)
3

Description

I have to develop my code on a custom python stack that doesn't fully conform to anaconda; many packages are initialized by adding them to PYTHONPATH with a command-line tool. I automated this by creating an activation script that went under etc/conda/activate.d. I also have a .env in the workspace root that sets the same PYTHONPATH. I works but I found the following issue:

  • When a unit test is started without debugging the procedure of running it is: 1) source .env 2) execute conda run ... which will result in sourcing the custom activation scripts under etc/conda/activate.d.
  • When a unit test is started in the debugger, the procedure differs: 1) source .env 2) execute some auto-generated script that will call the debugpy module. The custom activation scripts under etc/conda/activate.d seem not be sourced.

This can be an issue for some. The behavior should be that the conda environment is activated the same way while debugging and just executing unit tests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.