Skip to content

Commit 42bac6f

Browse files
committed
De-flaked unit tests
1 parent 3de5cf0 commit 42bac6f

File tree

4 files changed

+25
-8
lines changed

4 files changed

+25
-8
lines changed

.swiftpm/xcode/xcshareddata/xcschemes/OSCKit-CI.xcscheme

+7
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,13 @@
104104
debugServiceExtension = "internal"
105105
enableGPUValidationMode = "1"
106106
allowLocationSimulation = "YES">
107+
<EnvironmentVariables>
108+
<EnvironmentVariable
109+
key = "RUNNING_ON_CI"
110+
value = "1"
111+
isEnabled = "YES">
112+
</EnvironmentVariable>
113+
</EnvironmentVariables>
107114
</LaunchAction>
108115
<ProfileAction
109116
buildConfiguration = "Release"

Tests/OSCKitCoreTests/OSCKitCoreTests.swift

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ import XCTest
1010
import OSCKitCore
1111

1212
final class OSCKitCoreTests: XCTestCase {
13-
// empty base test file
14-
15-
func testEmpty() {
16-
XCTAssertTrue(true)
13+
// empty
14+
}
15+
16+
extension XCTestCase {
17+
func XCTSkipIfRunningOnCI() throws {
18+
if ProcessInfo.processInfo.environment["RUNNING_ON_CI"] != nil {
19+
throw XCTSkip("Skipping flaky test on CI.")
20+
}
1721
}
1822
}
1923

Tests/OSCKitTests/OSCKitTests.swift

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ import XCTest
1010
import OSCKit
1111

1212
final class OSCKitTests: XCTestCase {
13-
// empty base test file
14-
15-
func testEmpty() {
16-
XCTAssertTrue(true)
13+
// empty
14+
}
15+
16+
extension XCTestCase {
17+
func XCTSkipIfRunningOnCI() throws {
18+
if ProcessInfo.processInfo.environment["RUNNING_ON_CI"] != nil {
19+
throw XCTSkip("Skipping test on CI.")
20+
}
1721
}
1822
}
1923

Tests/OSCKitTests/OSCTimeTag OSC 1.0 Tests.swift

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ final class OSCTimeTag_OSC1_0_Tests: XCTestCase {
6767
}
6868

6969
func test1SecondInFuture() throws {
70+
try XCTSkipIfRunningOnCI()
71+
7072
let server = OSCServer(timeTagMode: .osc1_0)
7173

7274
let expEarly = expectation(description: "Message Dispatched Early")

0 commit comments

Comments
 (0)