← Back to issue list

test: use `new_dir` fixture

View original Github issue

Metadata

Project
craft-parts
Number
#624
Type
pull request
State
merged
Author
mr-cal
Labels
Created
Updated
Closed

Current evaluation

Merged after two approvals and passing CI. Replaced hardcoded temp file creation in two unit tests with the new_dir fixture to improve isolation. A side discussion suggested adding pyfakefs to test dependencies.

Suggested action:

No scores available.

Issue body

- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? ----- - `tests/unit/packages/test_base.py::TestOriginStagePackage::test_mark_origin_stage_package` was creating `.tests-xattr-test-dir/` in the cwd - `tests/unit/overlays/test_chroot.py::TestChroot::test_runner` was creating `foo.txt` in the cwd

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged after two approvals and passing CI. Replaced hardcoded temp file creation in two unit tests with the new_dir fixture to improve isolation. A side discussion suggested adding pyfakefs to test dependencies.
qwen3.6-35b-a3b-mtp-q6 Merged. Tests now use the new_dir fixture to prevent temporary files from polluting the current working directory. Maintainer approved and suggested adding pyfakefs to test dependencies to improve overall test execution speed.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#439 tests: protect fixture against chdir mocks craft-parts merged 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.
74%