Le bloc d'achèvement MagicalRecord n'est pas appelé sous la cible de test

MagicalRecord.saveWithBlock({ context in if let items = dictionary["items"] as? Array<NSDictionary> { for itemInfo in items { DBItem.findOrUpdateItemWithDictionary(itemInfo, inContext: context) } } //is called if let sets = dictionary["item_sets"] as? Array<NSDictionary> { for setInfo in sets { DBSet.findOrUpdateSetWithDictionary(setInfo, inContext: context) } } }, completion: { finished, error in completionBlock(error) //is not called }) 

Voici comment je configure ma stack de données de base:

 MagicalRecord.setupCoreDataStackWithInMemoryStore() 

La méthode saveWithBlock: est exécutée de manière asynchronous. Le test peut être terminé avant d'appeler le bloc d'achèvement bien que je ne sache pas comment est votre code de test.

https://github.com/magicalpanda/MagicalRecord/blob/c7b14f658b4fca32f8d33f8f76160203053ce4b9/MagicalRecord/Core/MagicalRecord%2BActions.m#L14-L35

Pourriez-vous essayer de changer la méthode saveWithBlockAndWait: Il est exécuté de manière synchrone. Ou attendre pour exécuter un appel asynchronous avec XCTestExpectation ?