Skip to content

Commit fd8f9bb

Browse files
committed
skip ai tests in ci
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
1 parent 06d5b43 commit fd8f9bb

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Tests/KasetTests/MusicIntentIntegrationTests.swift

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ import Testing
3737
/// xcodebuild test -scheme Kaset -destination 'platform=macOS' \
3838
/// -only-testing:KasetTests -skip-test-tag integration
3939
/// ```
40-
@Suite("MusicIntent Integration", .tags(.integration, .slow), .serialized)
40+
@Suite(
41+
"MusicIntent Integration",
42+
.tags(.integration, .slow),
43+
.serialized,
44+
.enabled(if: SystemLanguageModel.default.availability == .available, "Apple Intelligence required")
45+
)
4146
@MainActor
4247
struct MusicIntentIntegrationTests {
4348
// MARK: - Constants
@@ -68,9 +73,6 @@ struct MusicIntentIntegrationTests {
6873
/// Parses a natural language prompt into a MusicIntent using the LLM.
6974
/// Creates a fresh session per call to avoid context window overflow.
7075
private func parseIntent(from prompt: String) async throws -> MusicIntent {
71-
guard SystemLanguageModel.default.availability == .available else {
72-
throw AIUnavailableError()
73-
}
7476
// Create a fresh session each time to avoid context accumulation
7577
let session = LanguageModelSession(instructions: Self.systemPrompt)
7678
let response = try await session.respond(to: prompt, generating: MusicIntent.self)
@@ -96,8 +98,6 @@ struct MusicIntentIntegrationTests {
9698
let result = try await operation()
9799
try validate(result)
98100
return // Success
99-
} catch is AIUnavailableError {
100-
throw AIUnavailableError() // Don't retry unavailability
101101
} catch {
102102
lastError = error
103103
if attempt < maxAttempts {
@@ -107,7 +107,7 @@ struct MusicIntentIntegrationTests {
107107
}
108108
}
109109

110-
throw lastError ?? AIUnavailableError()
110+
throw lastError!
111111
}
112112

113113
// MARK: - Basic Actions (Parameterized)
@@ -342,11 +342,3 @@ struct MusicIntentIntegrationTests {
342342
}
343343
}
344344
}
345-
346-
// MARK: - AIUnavailableError
347-
348-
/// Error thrown when Apple Intelligence is not available.
349-
/// Tests catching this error should be considered skipped.
350-
struct AIUnavailableError: Error, CustomStringConvertible {
351-
var description: String { "Apple Intelligence not available on this device" }
352-
}

0 commit comments

Comments
 (0)