← Back to issue list

tests: protect fixture against chdir mocks

View original Github issue

Metadata

Project
craft-parts
Number
#439
Type
pull request
State
merged
Author
cmatsuoka
Labels
—
Created
Updated
Closed

Current evaluation

Merged in commit a540358a: the new_dir fixture now bypasses mocked os.chdir values, preventing test mocks from interfering with temporary-directory setup.

Resolution: closed resolved

Reason: PR #439 was approved and merged as commit a540358a, adding chdir/chroot test fixtures and ensuring new_dir uses the original os.chdir behavior.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Always call the original os.chdir in the new_dir fixture to prevent unexpected behavior if os.chdir is mocked in a test. Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com> - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged in commit a540358a: the new_dir fixture now bypasses mocked os.chdir values, preventing test mocks from interfering with temporary-directory setup.
stealth/space-bunny-alpha — closed resolved Merged PR #439, updating the new_dir fixture to use the original os.chdir so chdir mocks do not interfere with temporary-directory setup.
qwen/qwen3.6-35b-a3b — — Merged updates to the new_dir test fixture to always call the original os.chdir. This prevents unexpected behavior when tests mock the function. Approved by one reviewer and modified three files.
qwen3.6-35b-a3b-mtp-q6 — — Merged updates to the new_dir fixture that explicitly invoke the original os.chdir function, preventing unexpected behavior when os.chdir is mocked during tests.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#624 test: use `new_dir` fixture craft-parts merged Merged PR #624 as commit d214d9d8, updating two unit tests to use new_dir so test files no longer pollute the repository working directory.
74%