Skip to content

Cleanup unit test temp folders - #455

Merged
DanRStevens merged 9 commits into
mainfrom
cleanupUnitTestTempFolders
Aug 10, 2026
Merged

Cleanup unit test temp folders#455
DanRStevens merged 9 commits into
mainfrom
cleanupUnitTestTempFolders

Conversation

@DanRStevens

Copy link
Copy Markdown
Member

Cleanup temp folders as well as any generated temp files.

Rename temp folders so they are not shared by different test cases. This prevents unintended sharing of resources (the folder), and potential order dependent behaviors.

Related:

Closes #453

The constructor being tested does not branch differently based on relative path prefixes. There doesn't seem to be a clear purpose in testing this code with various prefixes. Maybe the lower level path handling code could use tests with various prefixes, though if needed that should get it's own tests rather than be a part of this one.
Actually, as a matter of style, I don't know how common it is to put unit test assertions in helper methods, as opposed to keeping all test assertions in the test case itself. Something about it seemed mildly unexpected, though I can see why it would be convenient.
These are effectively two separate behaviors, that should probably get two separate tests.
We don't want coupling between independent tests. We could check that a folder is not created in the failure test case, though if the create test case leaves one around, that could cause the failure test case to fail due to different tests on the same object.
The lack of cleanup was hidden by the cleanup in the recently updated test case. Whether a folder was left behind or not was potentially order dependent. This is because both test cases operated on the same folder, so effectively shared an object.
Potentially this could also be useful if tests are run in parallel, as using separate folders would prevent them from interfering with each other.
@DanRStevens
DanRStevens merged commit eaf0383 into main Aug 10, 2026
6 checks passed
@DanRStevens
DanRStevens deleted the cleanupUnitTestTempFolders branch August 10, 2026 13:55
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.

Unit tests litter repo with NewDirectory

1 participant