-
-
Notifications
You must be signed in to change notification settings - Fork 6
Improve test reliability #159
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
Conversation
6601292
to
6a4a093
Compare
@@ -24,8 +24,7 @@ import Testing | |||
|
|||
@testable import SafeDITool | |||
|
|||
@Suite(.serialized) | |||
final class SafeDIToolCodeGenerationErrorTests { | |||
struct SafeDIToolCodeGenerationErrorTests: ~Copyable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ~Copyable
conformance is required for deinit
to work on a struct
@@ -40,8 +39,8 @@ final class SafeDIToolCodeGenerationErrorTests { | |||
|
|||
// MARK: Error Tests | |||
|
|||
@MainActor @Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allows the test to run in parallel
@MainActor @Test | ||
func run_onCodeWithPropertyWithUnknownFulfilledType_throwsError() async { | ||
@Test | ||
mutating func run_onCodeWithPropertyWithUnknownFulfilledType_throwsError() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we pass in a modifiable filesToDelete: &filesToDelete
in each executeSafeDIToolTest
call, we need the test method to be mutating.
func test_include_throwsErrorWhenNoSwiftSourcesFilePathAndNoInclude() async { | ||
@Test | ||
func include_throwsErrorWhenNoSwiftSourcesFilePathAndNoInclude() async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eek. Missed converting this test in #156. Found a couple like this.
3ee0892
to
4906dde
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #159 +/- ##
==========================================
+ Coverage 99.88% 99.91% +0.02%
==========================================
Files 32 32
Lines 3483 3482 -1
==========================================
Hits 3479 3479
+ Misses 4 3 -1
🚀 New features to boost your workflow:
|
|
||
linux: | ||
name: Build and Test on Linux | ||
runs-on: ubuntu-latest | ||
container: swift:6.0 | ||
container: swift:6.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Swift Testing on Swift 6 doesn't like using ~Copyable
structs in tests
@@ -178,7 +178,7 @@ jobs: | |||
lint-swift: | |||
name: Lint Swift | |||
runs-on: ubuntu-latest | |||
container: swift:6.0 | |||
container: swift:6.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a functional change, but doesn't seem harmful
@@ -1,4 +1,4 @@ | |||
// swift-tools-version: 6.0 | |||
// swift-tools-version: 6.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
development in this lib should be in Swift 6.1. We just need to support building in Swift 6.
@@ -86,7 +86,7 @@ To install the SafeDI framework into an Xcode project with Swift Package Manager | |||
|
|||
#### CocoaPods | |||
|
|||
To add the SafeDI framework as a dependency to a package utilizing [CocoaPods](http://cocoapods.org), add the following to your `Podfile`: | |||
To add the SafeDI framework as a dependency to a package utilizing [CocoaPods](https://blog.cocoapods.org/CocoaPods-Specs-Repo), add the following to your `Podfile`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cocoapods.org
was down at the time of writing, causing a CI failure. So I've moved to linking to the blog post showing that CocoaPods is going away, which seems like a reasonable alternative.
80cca69
to
594f1b4
Compare
The move to Swift Testing in #156 introduced some nondeterminism due to our use of a single static pointer
FileFinder
. Swift Testing runs multiple tests in parallel, and multiple tests were smashing theFileFinder
pointer.This PR does two things:
FileFinder
.Best reviewed with whitespace changes ignored.