Skip to content

Commit ca6c725

Browse files
committed
WIP: Troubleshoot ci failure. Try setting up fetch tests with repository context
non-main-queue
1 parent a5e4c3d commit ca6c725

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

Tests/CoreDataRepositoryTests/FetchRepositoryTests.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,16 @@ final class FetchRepositoryTests: CoreDataXCTestCase {
3434

3535
override func setUpWithError() throws {
3636
try super.setUpWithError()
37-
_ = try movies.map { $0.asRepoManaged(in: try viewContext()) }
38-
try viewContext().save()
39-
expectedMovies = try viewContext().fetch(fetchRequest).map(\.asUnmanaged)
37+
try repositoryContext().performAndWait {
38+
do {
39+
_ = try movies.map { $0.asRepoManaged(in: try repositoryContext()) }
40+
try repositoryContext().save()
41+
expectedMovies = try repositoryContext().fetch(fetchRequest).map(\.asUnmanaged)
42+
} catch {
43+
XCTFail("Failed to setup context")
44+
}
45+
46+
}
4047
}
4148

4249
override func tearDownWithError() throws {

0 commit comments

Comments
 (0)