Skip to content

Commit a1f455d

Browse files
committed
Conditionalize integration tests on HF_TOKEN
1 parent 229904b commit a1f455d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Tests/HubTests/DownloaderTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct DownloaderUnitTests {
5353
}
5454

5555
@Suite("Downloader (integration)",
56-
.disabled(if: ProcessInfo.processInfo.environment["HUB_NETWORK_TESTS"] != "1", "Set HUB_NETWORK_TESTS=1 to run network tests"))
56+
.disabled(if: ProcessInfo.processInfo.environment["HF_TOKEN"] == "", "Set HF_TOKEN to run network tests"))
5757
struct DownloaderIntegrationTests {
5858
@Test("successful download and content matches", .timeLimit(.minutes(2)))
5959
func successfulDownload() async throws {

Tests/HubTests/HubApiIntegrationTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// HubApiIntegrationTests.swift
33
//
4-
// Networked tests gated by HUB_NETWORK_TESTS=1
4+
// Networked tests gated by HF_TOKEN=1
55
//
66

77
import Foundation
@@ -10,7 +10,7 @@ import Testing
1010
@testable import Hub
1111

1212
@Suite("Hub API (integration)",
13-
.disabled(if: ProcessInfo.processInfo.environment["HUB_NETWORK_TESTS"] != "1", "Set HUB_NETWORK_TESTS=1 to run network tests"))
13+
.disabled(if: ProcessInfo.processInfo.environment["HF_TOKEN"] == "", "Set HF_TOKEN to run network tests"))
1414
struct HubApiIntegrationTests {
1515
@Test(
1616
"config download (snake_case)",
@@ -53,7 +53,7 @@ struct HubApiIntegrationTests {
5353
}
5454

5555
@Suite("Snapshot download (integration)",
56-
.disabled(if: ProcessInfo.processInfo.environment["HUB_NETWORK_TESTS"] != "1", "Set HUB_NETWORK_TESTS=1 to run network tests"))
56+
.disabled(if: ProcessInfo.processInfo.environment["HF_TOKEN"] == "", "Set HF_TOKEN to run network tests"))
5757
struct SnapshotDownloadIntegrationTests {
5858
let repo = "coreml-projects/Llama-2-7b-chat-coreml"
5959
let lfsRepo = "pcuenq/smol-lfs"

Tests/HubTests/HubApiTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Testing
1111

1212
@Suite(
1313
"Hub API (filenames and metadata)",
14-
.disabled(if: ProcessInfo.processInfo.environment["HUB_NETWORK_TESTS"] != "1", "Set HUB_NETWORK_TESTS=1 to run network tests")
14+
.disabled(if: ProcessInfo.processInfo.environment["HF_TOKEN"] == "", "Set HF_TOKEN to run network tests")
1515
)
1616
struct HubApiFilenamesAndMetadataTests {
1717
// TODO: use a specific revision for these tests
@@ -110,7 +110,7 @@ struct HubApiFilenamesAndMetadataTests {
110110

111111
@Suite(
112112
"Snapshot download",
113-
.disabled(if: ProcessInfo.processInfo.environment["HUB_NETWORK_TESTS"] != "1", "Set HUB_NETWORK_TESTS=1 to run network tests")
113+
.disabled(if: ProcessInfo.processInfo.environment["HF_TOKEN"] == "", "Set HF_TOKEN to run network tests")
114114
)
115115
struct SnapshotDownloadTests {
116116
let repo = "coreml-projects/Llama-2-7b-chat-coreml"

0 commit comments

Comments
 (0)