fix(test): avoid coroutines in tests
This commit is contained in:
@@ -8,7 +8,6 @@ import io.github.moulberry.repo.data.Rarity
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.GlobalScope
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import net.minecraft.client.MinecraftClient
|
import net.minecraft.client.MinecraftClient
|
||||||
@@ -139,12 +138,17 @@ object RepoManager {
|
|||||||
|
|
||||||
fun reloadForTest(from: Path) {
|
fun reloadForTest(from: Path) {
|
||||||
neuRepo = makeNEURepository(from)
|
neuRepo = makeNEURepository(from)
|
||||||
GlobalScope.launch {
|
reloadSync()
|
||||||
reload()
|
}
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun reload() {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
reloadSync()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun reload() = withContext(Dispatchers.Default) {
|
fun reloadSync() {
|
||||||
try {
|
try {
|
||||||
logger.info("Repo reload started.")
|
logger.info("Repo reload started.")
|
||||||
neuRepo.reload()
|
neuRepo.reload()
|
||||||
|
|||||||
Reference in New Issue
Block a user