-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix testkit on sbt launching tests defined in other test modules when…
… depending on another test artifact (#2052) This workaround alters the classpath scanning logic to only consider classes defined in the first `test-classes` directory encountered on the classpath to be those defined in 'current module'. It seems that for SBT the heuristic that the current test module classes will be placed in the first `test-classes` dir on the classpath generally holds. However, if it fails, you may be able to fix test running by overriding `_sbtIsClassDefinedInCurrentTestModule` or `_sbtFindCurrentTestModuleClasspathElement` in your tests to suit your needs. Also fix `DistageScalatestTestSuiteRunner#modifyClasspathScan` modifier not being applied (it was never applied, ugh...)
- Loading branch information
Showing
6 changed files
with
257 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...ng-test/src/test/scala/izumi/distage/testkit/modulefiltering/SbtModuleFilteringTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package izumi.distage.testkit.modulefiltering | ||
|
||
final class SbtModuleFilteringTest extends SbtModuleFilteringPoisonPillTest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...c/test/scala/izumi/distage/testkit/modulefiltering/SbtModuleFilteringPoisonPillTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package izumi.distage.testkit.modulefiltering | ||
|
||
import izumi.distage.testkit.scalatest.SpecIdentity | ||
|
||
import java.util.concurrent.atomic.AtomicReference | ||
|
||
object SbtModuleFilteringPoisonPillTest { | ||
val poisonPillTestsLaunched: AtomicReference[Int] = new AtomicReference(0) | ||
} | ||
|
||
open class SbtModuleFilteringPoisonPillTest extends SpecIdentity { | ||
|
||
"SBT test module filtering fix" should { | ||
|
||
"prevent `sbt test` task in `distage-testkit-scalatest-sbt-module-filtering-test` from launching test classes defined in `distage-testkit-scalatest` test scope" in { | ||
val testsLaunched = SbtModuleFilteringPoisonPillTest.poisonPillTestsLaunched.updateAndGet(_ + 1) | ||
assert(testsLaunched == 1) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters