File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -581,6 +581,9 @@ lazy val scalacheck = project.in(file("test") / "scalacheck")
581
581
.settings(
582
582
fork in Test := false ,
583
583
javaOptions in Test += " -Xss1M" ,
584
+ testOptions += Tests .Cleanup { loader =>
585
+ ModuleUtilities .getObject(" scala.TestCleanup" , loader).asInstanceOf [Runnable ].run()
586
+ },
584
587
libraryDependencies ++= Seq (scalacheckDep),
585
588
unmanagedSourceDirectories in Compile := Nil ,
586
589
unmanagedSourceDirectories in Test := List (baseDirectory.value)
Original file line number Diff line number Diff line change @@ -38,9 +38,21 @@ class ParCollProperties extends Properties("Parallel collections") {
38
38
val ectasks = new collection.parallel.ExecutionContextTaskSupport (ec)
39
39
includeAllTestsWith(ectasks, " ectasks" )
40
40
41
- // no post test hooks in scalacheck, so cannot do:
42
- // ec.shutdown()
41
+ // no post test hooks in scalacheck, so the best we can do is:
42
+ TestCleanup .register(ec.shutdown())
43
+ }
44
+
43
45
46
+ object TestCleanup extends Runnable {
47
+ private val cleanups = scala.collection.mutable.Buffer [() => Unit ]()
48
+ def register (action : => Any ) = synchronized {
49
+ cleanups += {() => action}
50
+ }
51
+ // called by the SBT build. Scalacheck doesn't have any native support for cleanup
52
+ override def run (): Unit = {
53
+ cleanups.foreach(_.apply())
54
+ cleanups.clear()
55
+ }
44
56
}
45
57
46
58
/*
You can’t perform that action at this time.
0 commit comments