Fix `PythonLocator` to pass through `env` variables from the task template (#63154)
This matches `GoLocator` and `NodeLocator`
# Objective
The problem: `env` variables defined in `tasks.json` aren't used when
the task runs in debug mode.
Example:
```json
[
{
"label": "pytest (custom)",
"env": {
"DATABASE_URL": "...",
},
"command": "$ZED_CUSTOM_PYTHON_ACTIVE_ZED_TOOLCHAIN",
"args": [
"-m",
"pytest",
"$ZED_CUSTOM_PYTHON_TEST_TARGET",
],
"tags": ["python-pytest-class", "python-pytest-method"],
"cwd": "$ZED_WORKTREE_ROOT",
},
]
```
When a test runs normally, the `DATABASE_URL` variable is set correctly.
When the test runs in debug mode, the variable is not set.
## Solution
`PythonLocator` copies the `env` value from the `TaskTemplate`. This
matches other locators, such as `GoLocator` and `NodeLocator`
## Testing
- Did you test these changes? If so, how?
- The existing integration test is updated to verify the change
- Are there any parts that need more testing?
- No
- How can other people (reviewers) test your changes? Is there anything
specific they need to know?
- Run `cargo test -p project --test integration
debugger::python_locator::test_python_locator`
- If relevant, what platforms did you test these changes on, and are
there any important ones you can't test?
- Linux (NixOS), the change is platform-agnostic.
## Self-Review Checklist:
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md)
guidelines)
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable
## Showcase
N/A
---
Release Notes:
- Fix `PythonLocator` to pass through `env` variables from the task
template
49a841c7adAndrey Fedoseev committed on 8/24/2026, 4:43:13 PM· committed by GitHubparenta170a12