File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -581,6 +581,9 @@ lazy val scalacheck = project.in(file("test") / "scalacheck")
581581 .settings(
582582 fork in Test := false ,
583583 javaOptions in Test += " -Xss1M" ,
584+ testOptions += Tests .Cleanup { loader =>
585+ ModuleUtilities .getObject(" scala.TestCleanup" , loader).asInstanceOf [Runnable ].run()
586+ },
584587 libraryDependencies ++= Seq (scalacheckDep),
585588 unmanagedSourceDirectories in Compile := Nil ,
586589 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") {
3838 val ectasks = new collection.parallel.ExecutionContextTaskSupport (ec)
3939 includeAllTestsWith(ectasks, " ectasks" )
4040
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+
4345
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+ }
4456}
4557
4658/*
You can’t perform that action at this time.
0 commit comments