Skip to content

test: cover cache clear edge cases and stabilize parallel tests - #11106

Open
GreedyC wants to merge 5 commits into
python-poetry:mainfrom
GreedyC:codex/cache-clear-confirmation-tests
Open

GreedyC wants to merge 5 commits into
python-poetry:mainfrom
GreedyC:codex/cache-clear-confirmation-tests

Conversation

@GreedyC

@GreedyC GreedyC commented Sep 27, 2026 •

Copy link
Copy Markdown

Test-suite maintenance; no production code changes.

  • Add six cache clear cases for invalid keys and missing packages/versions, checking messages, exit codes, and unchanged cache contents. Module coverage including branches increases from 88% to 97%.
  • Bound the full-pipe regression with a 30-second subprocess timeout instead of a one-second thread join. Both output variants passed Windows Python 3.11 in run 36312975783.
  • Isolate the editable builder's generated setup.py in tmp_path. In that same run, the fallback test created and removed the file in the shared fixture while another worker copied it, causing shutil.Error. An assertion guards against returning to the shared directory; it fails before the fixture change and passes after it.

Validation on macOS / Homebrew Python 3.14.6:

  • 121 related tests passed with four workers, including the editable installation test.
  • Broad suite: 3314 passed, 33 skipped, 2 xfailed. Integration-marked tests were not enabled; the existing C-extension build test was excluded locally because the Xcode license has not been accepted.
  • Repository-wide pre-commit and mypy (380 files) passed.

Cross-platform CI passed for a9efcec: Tests run 36313710298, covering Windows, macOS and Ubuntu with Python 3.10–3.15. pre-commit.ci also passed.

Prepared with assistance from OpenAI Codex.

Relates-to: #3155

Verify exit codes, diagnostics, and unchanged cache file contents for incomplete and overlong keys, and missing packages or versions. Relates-to: python-poetry#3155

Assisted-by: OpenAI Codex <noreply@openai.com>
Copilot AI lite review requested due to automatic review settings September 27, 2026 10:21
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 27, 2026

@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 assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

No unresolved review comments; changes are focused test coverage.

Review effort: Lite
Findings: None

What changed in this PR

Adds regression tests for invalid and missing poetry cache clear keys, verifying errors, output, exit codes, and cache preservation.

Changes:

  • Adds cache-content snapshot helper.
  • Covers incomplete and malformed keys.
  • Covers missing packages and versions.
File Description
tests/​console/​commands/​cache/​test_clear.py Adds six cache-clear edge-case tests.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Replace the one-second thread join with a direct call using a 30-second subprocess timeout. This tolerates slow runners and terminates the child if the pipe regression actually blocks.

Assisted-by: OpenAI Codex <noreply@openai.com>
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 27, 2026

@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.

Sourcery assessment

Approved.

Copy extended_project into tmp_path before the setup fallback test writes and removes setup.py. This prevents racing the parallel editable installation test while it copies the shared fixture. Assert the build project stays within the per-test directory.

Assisted-by: OpenAI Codex <noreply@openai.com>
@GreedyC GreedyC changed the title test(cache): cover invalid keys and missing entries test: cover cache clear edge cases and stabilize parallel tests Sep 27, 2026
sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 27, 2026

@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.

Sourcery assessment

Approved.

@GreedyC

GreedyC commented Oct 4, 2026

Copy link
Copy Markdown
Author

Merged current main and resolved the pipe-test conflict by retaining the upstream regression, including its Thread import. Cache-clear and environment tests pass locally on Homebrew Python 3.14: 59 tests; Ruff check and format check also pass for the relevant files.

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Oct 4, 2026

@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.

Sourcery assessment

Approved.

@GreedyC

GreedyC commented Oct 4, 2026

Copy link
Copy Markdown
Author

Correction: the restored Thread import passed locally but was accidentally left unstaged in the previous merge commit. CI correctly caught that mismatch. It is now included in 33db9ea; the previous failing runs should not be treated as an upstream issue.

@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.

Sourcery assessment

Approved.

This branch has not been deployed

No deployments
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.

2 participants