Skip to content

test: Test code improvements#1655

Merged
thomhurst merged 12 commits into
mainfrom
fix/test-cleanup
Dec 30, 2025
Merged

test: Test code improvements#1655
thomhurst merged 12 commits into
mainfrom
fix/test-cleanup

Conversation

@thomhurst
Copy link
Copy Markdown
Owner

Summary

  • Remove unused Microsoft.Extensions.Time.Testing import from NotInParallel test files
  • Add cleanup method for ZipTests artifacts (LoremData.zip and LoremDataUnzipped directory)

Test plan

  • Verified the project builds successfully
  • Removed imports are confirmed unused
  • Cleanup method follows TUnit [After(Class)] pattern for class-level cleanup

Closes #1653, #1652

🤖 Generated with Claude Code

thomhurst and others added 12 commits December 29, 2025 18:39
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove the unused `Microsoft.Extensions.Time.Testing` import from three
NotInParallel test files that no longer use FakeTimeProvider.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add [After(Class)] cleanup method to ZipTests to delete LoremData.zip and
LoremDataUnzipped directory after tests complete, preventing test artifacts
from accumulating in the working directory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@thomhurst
Copy link
Copy Markdown
Owner Author

Summary

This PR adds cleanup logic for test artifacts in ZipTests and removes unused imports from three test files.

Critical Issues

None found ✅

The changes are straightforward:

  • ZipTests.cs: Adds proper cleanup of test artifacts (LoremData.zip and LoremDataUnzipped directory) using TUnit's [After(Class)] hook
  • NotInParallelTests.cs*: Removes unused Microsoft.Extensions.Time.Testing imports

Suggestions

Minor: Redundant await in cleanup method (ZipTests.cs:13-14)
The await Task.CompletedTask; at the start of the Cleanup() method is unnecessary since the rest of the method is synchronous. You can either:

  • Remove the async keyword and await Task.CompletedTask entirely, OR
  • Remove just the await Task.CompletedTask line

This is purely a style issue and doesn't affect functionality.

Verdict

APPROVE - No critical issues

The cleanup logic properly addresses potential test pollution issues where zip artifacts could interfere with subsequent test runs. The unused import removal is good housekeeping.

@thomhurst thomhurst merged commit 294623d into main Dec 30, 2025
10 of 12 checks passed
@thomhurst thomhurst deleted the fix/test-cleanup branch December 30, 2025 12:30
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.

Code smell: Unused import FakeTimeProvider in NotInParallel test files

1 participant