Skip to content

test: cover config migration dry run#10891

Open
theamodhshetty wants to merge 2 commits into
python-poetry:mainfrom
theamodhshetty:codex/test-config-migration-dry-run
Open

test: cover config migration dry run#10891
theamodhshetty wants to merge 2 commits into
python-poetry:mainfrom
theamodhshetty:codex/test-config-migration-dry-run

Conversation

@theamodhshetty
Copy link
Copy Markdown
Contributor

Summary

  • add focused tests for ConfigSourceMigration.dry_run() output
  • verify dry runs leave the config untouched for rename, removal, unset, and missing-key paths

Tests

  • .venv/bin/ruff format tests/config/test_config_source.py
  • .venv/bin/ruff check tests/config/test_config_source.py
  • .venv/bin/python -m pytest tests/config/test_config_source.py -n 0

Relates-to: #3155

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The dry-run tests hard-code the full io.fetch_output() string including spacing and newlines, which may be brittle; consider normalizing (e.g., using .strip() or checking substrings) so minor formatting changes don't unnecessarily break the tests.
  • The four dry_run tests share a lot of setup and follow the same pattern; you could reduce duplication and make future changes easier by parametrizing them (e.g., expected return value and expected output per migration scenario).
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The dry-run tests hard-code the full `io.fetch_output()` string including spacing and newlines, which may be brittle; consider normalizing (e.g., using `.strip()` or checking substrings) so minor formatting changes don't unnecessarily break the tests.
- The four `dry_run` tests share a lot of setup and follow the same pattern; you could reduce duplication and make future changes easier by parametrizing them (e.g., expected return value and expected output per migration scenario).

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.

@theamodhshetty
Copy link
Copy Markdown
Contributor Author

Thanks for the review. I pushed bd622ac to parametrize the dry-run cases and trim the trailing newline from the output comparison, while still keeping the actual user-facing message text asserted.

Local checks I reran:

  • .venv/bin/ruff format tests/config/test_config_source.py
  • .venv/bin/ruff check tests/config/test_config_source.py
  • .venv/bin/python -m pytest tests/config/test_config_source.py -n 0

The earlier Ubuntu 3.10 pytest failure looks unrelated to this diff (sys.platform was mocked as darwin in an installer test and leaked into sysconfig). The new push should give CI a fresh run.

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