← 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 PR #624 as commit d214d9d8, updating two unit tests to use new_dir so test files no longer pollute the repository working directory.

Resolution: closed resolved

Reason: PR #624 was merged as commit d214d9d8. It applies the new_dir fixture so .tests-xattr-test-dir and foo.txt are created in an isolated temporary working directory.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged PR #624 as commit d214d9d8, updating two unit tests to use new_dir so test files no longer pollute the repository working directory.
stealth/space-bunny-alpha — closed resolved Merged craft-parts PR #624 in commit d214d9d8: unit tests now use the new_dir fixture, preventing stray files in the working directory.
stealth/space-bunny-alpha — closed resolved Merged test cleanup to use the new_dir fixture, preventing two unit tests from creating stray files in the working directory.
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
#1078 tests: do not rely on project_dir snapcraft merged Merged PR #1078 removed tests' reliance on project_dir, resolving LP #1659356; it landed as commit 4fe0247b8.
76%
#3719 tests: fix lifecycle tests to run on new directory snapcraft merged Merged PR #3719 via commit 314dd7574 to run lifecycle tests in a new directory instead of the current directory.
75%
#439 tests: protect fixture against chdir mocks craft-parts merged Merged in commit a540358a: the new_dir fixture now bypasses mocked os.chdir values, preventing test mocks from interfering with temporary-directory setup.
74%
#551 Reenable get and set tourdir unit tests snapcraft merged Merged PR #551 as commit 4ae5e7a09, re-enabling tourdir getter/setter tests and resetting internal directory paths via cleanup to remove order dependence.
74%
#51 cleanup: don't write test files in cwd rockcraft merged Merged PR #51 in commit 8e9145c1, switching unit tests to tmp_path so test files no longer pollute the working directory.
71%
#1077 test: fix directory test strategy craft-parts merged Merged PR #1077 (a45a78ad) fixed the directory test strategy so generated partitions cannot duplicate the "default" name.
70%