diff --git a/.vscode/settings.json b/.vscode/settings.json index 29293adb..9b00789e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -34,5 +34,7 @@ }, "swift.swiftEnvironmentVariables": { "DEVELOPER_DIR": "/Applications/Xcode.app" - } + }, + // Disable automatic generation of launch `launch.json` + "swift.autoGenerateLaunchConfigurations": false } \ No newline at end of file diff --git a/Package.swift b/Package.swift index a7bc2b2e..94905245 100644 --- a/Package.swift +++ b/Package.swift @@ -36,9 +36,6 @@ let package = Package( .target(name: "Models", dependencies: ["Tokenizers", "Generation", "TensorUtils"]), .testTarget(name: "TokenizersTests", dependencies: ["Tokenizers", "Models", "Hub"], resources: [.process("Resources"), .process("Vocabs")]), .testTarget(name: "HubTests", dependencies: ["Hub", .product(name: "Jinja", package: "Jinja")], swiftSettings: swiftSettings), - .testTarget(name: "PreTokenizerTests", dependencies: ["Tokenizers", "Hub"]), .testTarget(name: "TensorUtilsTests", dependencies: ["TensorUtils", "Models", "Hub"], resources: [.process("Resources")]), - .testTarget(name: "NormalizerTests", dependencies: ["Tokenizers", "Hub"]), - .testTarget(name: "PostProcessorTests", dependencies: ["Tokenizers", "Hub"]), ] ) diff --git a/Tests/HubTests/DownloaderTests.swift b/Tests/HubTests/DownloaderTests.swift index 09156aab..7ce43260 100644 --- a/Tests/HubTests/DownloaderTests.swift +++ b/Tests/HubTests/DownloaderTests.swift @@ -11,27 +11,6 @@ import XCTest @testable import Hub import XCTest -/// Errors that can occur during the download process -enum DownloadError: LocalizedError { - case invalidDownloadLocation - case unexpectedError - - var errorDescription: String? { - switch self { - case .invalidDownloadLocation: - String(localized: "The download location is invalid or inaccessible.", comment: "Error when download destination is invalid") - case .unexpectedError: - String(localized: "An unexpected error occurred during the download process.", comment: "Generic download error message") - } - } -} - -private extension Downloader { - func interruptDownload() async { - await session.get()?.invalidateAndCancel() - } -} - final class DownloaderTests: XCTestCase { var tempDir: URL! @@ -164,7 +143,8 @@ final class DownloaderTests: XCTestCase { if threshold != 1.0, progress >= threshold { // Move to next threshold and interrupt threshold = threshold == 0.5 ? 0.75 : 1.0 - await downloader.interruptDownload() + // Interrupt download + await downloader.session.get()?.invalidateAndCancel() } case let .failed(error): throw error diff --git a/Tests/HubTests/HubApiTests.swift b/Tests/HubTests/HubApiTests.swift index 56dfadbc..7fa20b97 100644 --- a/Tests/HubTests/HubApiTests.swift +++ b/Tests/HubTests/HubApiTests.swift @@ -9,15 +9,7 @@ import XCTest @testable import Hub class HubApiTests: XCTestCase { - override func setUp() { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - // MARK: use a specific revision for these tests + // TODO: use a specific revision for these tests func testFilenameRetrieval() async { do { diff --git a/Tests/TokenizersTests/BertTokenizerTests.swift b/Tests/TokenizersTests/BertTokenizerTests.swift index a98f5092..bd72fd22 100644 --- a/Tests/TokenizersTests/BertTokenizerTests.swift +++ b/Tests/TokenizersTests/BertTokenizerTests.swift @@ -11,14 +11,6 @@ import XCTest class BertTokenizerTests: XCTestCase { - override func setUp() { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - lazy var bertTokenizer: BertTokenizer = { let vocab = { let url = Bundle.module.url(forResource: "bert-vocab", withExtension: "txt")! diff --git a/Tests/NormalizerTests/NormalizerTests.swift b/Tests/TokenizersTests/NormalizerTests.swift similarity index 100% rename from Tests/NormalizerTests/NormalizerTests.swift rename to Tests/TokenizersTests/NormalizerTests.swift diff --git a/Tests/PostProcessorTests/PostProcessorTests.swift b/Tests/TokenizersTests/PostProcessorTests.swift similarity index 100% rename from Tests/PostProcessorTests/PostProcessorTests.swift rename to Tests/TokenizersTests/PostProcessorTests.swift diff --git a/Tests/PreTokenizerTests/PreTokenizerTests.swift b/Tests/TokenizersTests/PreTokenizerTests.swift similarity index 100% rename from Tests/PreTokenizerTests/PreTokenizerTests.swift rename to Tests/TokenizersTests/PreTokenizerTests.swift