mirror of
https://github.com/sbt/sbt.git
synced 2026-09-04 00:41:32 +02:00
Fix #8345: forked test execution doesn't access main resources
Fixes issue where tests running in forked mode (Test / fork := true) cannot access resources from src/main/resources, while non-forked execution works correctly. Root cause: Context classloader not set: tests using Thread.currentThread().getContextClassLoader() couldn't find resources because the context classloader wasn't set to the URLClassLoader with the classpath Solution: Set context classloader in ForkTestMain.runTests() to the URLClassLoader containing the test classpath
This commit is contained in:
@@ -325,6 +325,7 @@ public class ForkTestMain {
|
||||
}
|
||||
|
||||
private void runTests(TestInfo info, ClassLoader classLoader) throws Exception {
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
final ExecutorService executor = executorService(info.parallel);
|
||||
final TaskDef[] tests = info.taskDefs.toArray(new TaskDef[] {});
|
||||
final int nFrameworks = info.testRunners.size();
|
||||
|
||||
Reference in New Issue
Block a user