Skip to content

Tests: Do not use mix of XCTest and Swift Testing #8942

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bkhouri
Copy link
Contributor

@bkhouri bkhouri commented Jul 16, 2025

The fixture(..) helper function is being used in XCTest and Swift Testing tests. However, there was a code path that could lead to calling XCTFail(), which is a no-op in Swift Testing.

This change rename the functio to fixtureXCTest, and marks it as deprecated with a note indicating to migrate the test to Swift Testing. In addition, create a Swift Testing equivalent of the fixture class that calls the relevant APIs.

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 16, 2025

@swift-ci tests

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 16, 2025

@swift-ci test macOS

The fixture(..) helper function is being used in XCTest and Swift
Testing tests. However, there was a code path that could lead to calling
XCTFail(), which is a no-op in Swift Testing.

This change rename the functio to fixtureXCTest, and marks it as
deprecated with a note indicating to migrate the test to Swift Testing.
In addition, create a Swift Testing equivalent of the fixture class that
calls the relevant APIs.
@bkhouri bkhouri marked this pull request as ready for review July 21, 2025 17:12
return try await body(preparedFixture)
}
} catch SwiftPMError.executionFailure(let error, let output, let stderr) {
print("**** FAILURE EXECUTING SUBPROCESS ****")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

suggestion: we should also consider dumping out the command line arguments.

@bkhouri bkhouri force-pushed the t/main/fix_potential_st_xctest_issue branch from 9e717c9 to 4dba299 Compare July 21, 2025 17:17
@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 21, 2025

@swift-ci test

@bkhouri
Copy link
Contributor Author

bkhouri commented Jul 21, 2025

@swift-ci test windows

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.

1 participant