Skip to content

Respect env PATH when locating mitmdump binary#17

Open
recursiveAF wants to merge 3 commits intomainfrom
fix/mitmdump-path-lookup
Open

Respect env PATH when locating mitmdump binary#17
recursiveAF wants to merge 3 commits intomainfrom
fix/mitmdump-path-lookup

Conversation

@recursiveAF
Copy link
Contributor

Summary

  • MitmproxyManager now uses the PATH from the env dict passed to Flow.spawn() when locating mitmdump
  • Added env field to MitmproxyConfig dataclass
  • Added unit tests for PATH lookup behavior

Problem

Previously, shutil.which("mitmdump") used the pytest process's PATH, ignoring the env parameter passed to Flow.spawn(). This meant users couldn't use a custom PATH to locate mitmdump in non-standard locations.

Solution

Extract the PATH from the user-provided env dict and pass it to shutil.which(path=...).

Test plan

  • Added 3 unit tests in test_mitmproxy_manager.py
  • All 31 tests pass

🤖 Generated with Claude Code

recursiveAF and others added 3 commits January 27, 2026 09:56
ONCE mode now replays existing entries AND records new ones on cache miss,
instead of failing when encountering instructions not in the cassette.

This fixes the bug where the first test passes but subsequent tests fail
with "Cache miss in replay mode" even though noot should be recording.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add blank line after imports in cache.py
- Remove unused imports in test_cache_modes.py

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, MitmproxyManager used shutil.which("mitmdump") which only
searched the pytest process's PATH, ignoring the env dict passed to
Flow.spawn(). This caused issues when users set a custom PATH in env
to locate mitmdump in non-standard locations.

Now MitmproxyConfig accepts an env parameter, and MitmproxyManager
extracts the PATH from it (if present) to pass to shutil.which().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant