GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — Keep python crawl tests off the host's venv by mikolalysenko · Pull Request #2055 · SocketDev/socket-patch Conversation
|
| env | result |
|---|---|
| clean | 102 passed |
VIRTUAL_ENV=<a real venv> |
5 failed: test_crawl_all_python, test_crawl_all_not_poisoned_by_body_headers, test_crawl_all_recovers_metadata_less_package, base_copy_behind_a_system_site_venv_is_crawled, venv_copy_hides_the_base_copy_of_the_same_package |
CONDA_PREFIX=<a real venv> |
1 failed: poetry_out_of_tree_virtualenvs_are_discovered_without_a_dot_venv |
A contributor working from an activated venv or conda env gets red tests on a clean checkout.
PythonCrawler::crawl_all and get_site_packages_paths build their env lookup from std::env::var, and an activated VIRTUAL_ENV beats the fixture's ./.venv. The Poetry test already clears VIRTUAL_ENV under #[serial], but not CONDA_PREFIX, which poetry_active_prefix treats the same way.
get_site_packages_paths_with(options, var) and crawl_all_with(options, var). They take the env lookup as a closure, as local_site_packages_with already does. The public functions pass the process env exactly as before, so behaviour doesn't change._with variants with a no_env lookup. I injected the env instead of an EnvGuard + #[serial] on purpose: mutating process env while other tests run in parallel is itself a flake source.CONDA_PREFIX.No test is removed and no assertion changed. Each test asserts the same thing on the same fixtures.
cargo test -p socket-patch-core --lib crawlers:: after the change:
| env | result |
|---|---|
| clean | 798 passed |
VIRTUAL_ENV=<venv> |
798 passed |
CONDA_PREFIX=<venv> |
798 passed |
VIRTUAL_ENV + CONDA_PREFIX + CONDA_DEFAULT_ENV=x |
798 passed |
crawlers::python_crawler under VIRTUAL_ENV+CONDA_PREFIX, 20 repeats: 0 failures.cargo clippy --locked -p socket-patch-core --all-features -- -D warnings (CI's clippy) is clean. With --all-targets the set of lints per file is identical to main (all pre-existing, in test code).rustfmt --check passes on the touched file.The public crawl_all stays covered by randomized_site_packages_match_the_async_oracle and the CLI integration suites.
Together with #2054 this meets #1919's acceptance criteria for crawlers::, apart from the two npm_crawler tests #2054 lists, which need the yarn env threaded through NpmCrawler.
Refs #1919
Generated by Claude Code
Generated by Claude Code
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Five python_crawler unit tests went through crawl_all and get_site_packages_paths, which read VIRTUAL_ENV and CONDA_PREFIX from the process. In an activated venv the crawler takes that venv instead of the fixture's .venv, so the tests fail on a clean checkout. CI passes only because no job activates a venv. Split out crawl_all_with and get_site_packages_paths_with, which take the env lookup as a closure like local_site_packages_with already does. The public functions pass the process env as before, so behaviour doesn't change. The five tests pass an empty env. poetry_out_of_tree_virtualenvs_are_discovered_without_a_dot_venv already cleared VIRTUAL_ENV under #[serial]; it now clears CONDA_PREFIX too, which Poetry treats the same way. Refs #1919 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_011f9aePBmHCMsHKaD7js5Fu
|
bugbot run Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
PR SummaryLow Risk Overview This PR introduces injectable Reviewed by Cursor Bugbot for commit 144d4ab. Configure here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 144d4ab. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Ready for review at
Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Final review briefWhat it does. Python crawler unit tests no longer depend on the host's activated venv or conda env. Risk: low. It touches one file. It is a pure refactor of two methods plus test-only changes. No assertion was changed and no test was removed. Look here
Verified
Changes I made: none. Auto-merge is armed, so approving sends it straight to the merge queue. Generated by Claude Code |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.