Skip to content

tests: deduplicate environment check output helper#10983

Open
loulanyue wants to merge 1 commit into
python-poetry:mainfrom
loulanyue:tests/deduplicate-env-check-output-helper
Open

tests: deduplicate environment check output helper#10983
loulanyue wants to merge 1 commit into
python-poetry:mainfrom
loulanyue:tests/deduplicate-env-check-output-helper

Conversation

@loulanyue

Copy link
Copy Markdown

Relates-to: #3155

Summary

  • move the duplicated environment check_output mock into tests.helpers
  • preserve the console tests' /usr base prefix and the environment manager tests' runtime sys.base_prefix
  • import the shared helper directly from each affected test module

This removes 34 net lines while keeping the existing test behavior unchanged.

Verification

  • pytest -n 0 tests/console/commands/env/test_use.py tests/console/commands/env/test_remove.py tests/utils/env/test_env_manager.py (68 passed)
  • mypy tests/helpers.py tests/console/commands/env/helpers.py tests/console/commands/env/test_remove.py tests/console/commands/env/test_use.py tests/utils/env/test_env_manager.py
  • pre-commit run --files tests/helpers.py tests/console/commands/env/helpers.py tests/console/commands/env/test_remove.py tests/console/commands/env/test_use.py tests/utils/env/test_env_manager.py

The local Homebrew environment provides python3 but no bare python, so the pytest run used a temporary PATH entry mapping python to python3. No repository files were changed for that local environment difference.

Checklist

  • Updated and ran the affected tests.
  • Updated documentation (not applicable; test-only cleanup).

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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