Skip to content

test: pin cwd for deep-coverage CLI fixtures - #3274

Merged
Daniel Meppiel (danielmeppiel) merged 1 commit into
mainfrom
danielmeppiel/fix-deps-list-flake
Oct 19, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 1 commit into
mainfrom
danielmeppiel/fix-deps-list-flake

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

tests/integration/test_commands_deep_coverage.py passed the project to the CLI through obj={"cwd": ...}, which no command reads, so apm deps list ran in whatever directory the xdist worker was left in. When an earlier test had removed that directory, deps list exited 1 ([x] Error listing dependencies: [Errno 2] No such file or directory). This failed test_deps_list_no_apm_modules on macOS arm64 in the v0.34.0 tag run (39231396347) and in the 2026-10-14 nightly.

The project_with_deps / project_no_deps fixtures now monkeypatch.chdir into the project, so every test in the file runs against the project it builds.

Issue and approved scope

Issue: N/A -- maintainer-directed release-gate repair for v0.34.0 (#3250); follow-up to #3251, #3253, #3262.

Human scope-approval comment: Daniel Meppiel (@danielmeppiel) directed in-session to bypass-merge release-gate fixes "until we can guarantee the release will go through".

Does this PR complete the issue, or what remains? Completes this flake.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • Reproduced the cause: apm deps list from a deleted cwd -> exit 1 with the error above.

  • uv run --extra dev pytest tests/integration/test_commands_deep_coverage.py -- 28 passed.

  • ruff check / ruff format --check on the file -- pass.

Spec conformance (OpenAPM v0.1)

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

The deep-coverage CLI tests passed the project via `obj={"cwd": ...}`, which
no command reads, so `apm deps list` ran in whatever directory the xdist
worker was left in. When an earlier test removed that directory,
`deps list` exited 1 ("No such file or directory"), failing the v0.34.0
tag run on macOS arm64. The project fixtures now chdir into the project.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 761bf207-57da-41d0-bd3f-ffecbb97b83a

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrow fixture changes correctly isolate CLI execution and restore the working directory automatically, with no unresolved findings.

No open issues 🎉

What changed in this PR

Fixes working-directory isolation in deep-coverage CLI tests, addressing a release-gate flake without changing production behavior.

Changes:

  • Both project fixtures enter their temporary project directory using monkeypatch.chdir.
  • Comments explain why passing obj["cwd"] does not select the CLI project.
File Description
tests/​integration/​test_commands_deep_coverage.py Pins both project fixtures to the intended working directory.

Review effort: Balanced

@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 65b3b9f into main Oct 19, 2026
21 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel/fix-deps-list-flake branch October 19, 2026 10:36
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