Skip to content

Tests: Ensure we get clean test fixtures #8507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2025
Merged

Conversation

pmattos
Copy link
Contributor

@pmattos pmattos commented Apr 15, 2025

Motivation:

When running tests ensure the test fixtures we copy over to temporary directories don't carry over any previous build information.

Modifications:

When copying packages from /Fixtures/** we now ensure we delete any .build or .swiftpm directories, if any.

Result:

Safer tests hopefully :-)

PS. This was driving me nuts as I was playing around with a given /Fixtures/Foo but also running tests against it! The tests behaviour would vary depending on what swift commands I had previously ran in /Fixtures/Foo... fun times! 🙃


// Ensure we get a clean test fixture.
try localFileSystem.removeFileTree(dstDir.appending(component: ".build"))
try localFileSystem.removeFileTree(dstDir.appending(component: ".swiftpm"))
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix... the rest is just code formatting.

@pmattos
Copy link
Contributor Author

pmattos commented Apr 15, 2025

@swift-ci test

@pmattos
Copy link
Contributor Author

pmattos commented Apr 16, 2025

@swift-ci test macOS

@pmattos
Copy link
Contributor Author

pmattos commented Apr 16, 2025

@swift-ci test self hosted windows

@pmattos pmattos merged commit 0b23073 into main Apr 17, 2025
7 checks passed
@pmattos pmattos deleted the pmattos/clean-test-fixtures branch April 17, 2025 00:34
johnbute pushed a commit to johnbute/fork-swift-package-manager that referenced this pull request Apr 17, 2025
### Motivation:

When running tests ensure the *test fixtures* we copy over to 
temporary directories don't carry over any previous build information.

### Modifications:

When copying packages from `/Fixtures/**` we now ensure we 
delete any `.build` or `.swiftpm` directories, if any.
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.

3 participants