@@ -11,7 +11,7 @@ import org.specs2.control.Action
11
11
import org .specs2 .fp .Tree .Node
12
12
import org .specs2 .fp .{Tree , TreeLoc }
13
13
import org .specs2 .main .{Arguments , CommandLine , Select }
14
- import org .specs2 .specification .core .{Env , Fragment , SpecStructure }
14
+ import org .specs2 .specification .core .{Env , Fragment , SpecStructure , SpecificationStructure }
15
15
import org .specs2 .specification .process .Stats
16
16
17
17
import java .util
@@ -48,14 +48,17 @@ class Specs2PrefixSuffixTestDiscoveringSuite(suite: Class[Any], runnerBuilder: R
48
48
49
49
object Specs2FilteringRunnerBuilder {
50
50
val f : FilteringRunnerBuilder = {
51
- case (_ : org.specs2.runner.JUnitRunner , testClass : Class [_], pattern : Pattern ) =>
52
- new FilteredSpecs2ClassRunner (testClass, pattern)
51
+ case (parentRunner : org.specs2.runner.JUnitRunner , testClass : Class [_], pattern : Pattern ) =>
52
+ new FilteredSpecs2ClassRunner (parentRunner, testClass, pattern)
53
53
}
54
54
}
55
55
56
- class FilteredSpecs2ClassRunner (testClass : Class [_], testFilter : Pattern )
56
+ class FilteredSpecs2ClassRunner (parentRunner : org.specs2.runner. JUnitRunner , testClass : Class [_], testFilter : Pattern )
57
57
extends org.specs2.runner.JUnitRunner (testClass) {
58
58
59
+ // taking it from parent so not to initialize test classes multiple times
60
+ override lazy val specification : SpecificationStructure = parentRunner.specification
61
+
59
62
override def getDescription (env : Env ): Description = {
60
63
try createFilteredDescription(specStructure, env.specs2ExecutionEnv)
61
64
catch { case NonFatal (t) => env.shutdown; throw t; }
0 commit comments