diff --git a/main/actions/src/main/scala/sbt/Tests.scala b/main/actions/src/main/scala/sbt/Tests.scala index 36f93a5c0..d6eb4118a 100644 --- a/main/actions/src/main/scala/sbt/Tests.scala +++ b/main/actions/src/main/scala/sbt/Tests.scala @@ -113,15 +113,7 @@ object Tests val excludeTestsSet = new HashSet[String] val setup, cleanup = new ListBuffer[ClassLoader => Unit] val testListeners = new ListBuffer[TestReportListener] - val testArgsByFramework = Map[Framework, ListBuffer[String]]() val undefinedFrameworks = new ListBuffer[String] - def frameworkArgs(framework: Framework, args: Seq[String]): Unit = - testArgsByFramework.getOrElseUpdate(framework, new ListBuffer[String]) ++= args - def frameworkArguments(framework: TestFramework, args: Seq[String]): Unit = - (frameworks get framework) match { - case Some(f) => frameworkArgs(f, args) - case None => undefinedFrameworks ++= framework.implClassNames - } for(option <- config.options) { @@ -142,8 +134,7 @@ object Tests * -- command line arguments (ex: test-only someClass -- someArg) * (currently, command line args must be passed to all frameworks) */ - case Argument(Some(framework), args) => frameworkArguments(framework, args) - case Argument(None, args) => frameworks.values.foreach { f => frameworkArgs(f, args) } + case a: Argument => // now handled by whatever constructs `runners` } } @@ -155,19 +146,18 @@ object Tests def includeTest(test: TestDefinition) = !excludeTestsSet.contains(test.name) && testFilters.forall(filter => filter(test.name)) val filtered0 = discovered.filter(includeTest).toList.distinct val tests = if(orderedFilters.isEmpty) filtered0 else orderedFilters.flatMap(f => filtered0.filter(d => f(d.name))).toList.distinct - val arguments = testArgsByFramework.map { case (k,v) => (k, v.toList) } toMap; - testTask(testLoader, frameworks, runners, tests, setup.readOnly, cleanup.readOnly, log, testListeners.readOnly, arguments, config) + testTask(testLoader, frameworks, runners, tests, setup.readOnly, cleanup.readOnly, log, testListeners.readOnly, config) } def testTask(loader: ClassLoader, frameworks: Map[TestFramework, Framework], runners: Map[TestFramework, Runner], tests: Seq[TestDefinition], userSetup: Iterable[ClassLoader => Unit], userCleanup: Iterable[ClassLoader => Unit], - log: Logger, testListeners: Seq[TestReportListener], arguments: Map[Framework, Seq[String]], config: Execution): Task[Output] = + log: Logger, testListeners: Seq[TestReportListener], config: Execution): Task[Output] = { def fj(actions: Iterable[() => Unit]): Task[Unit] = nop.dependsOn( actions.toSeq.fork( _() ) : _*) def partApp(actions: Iterable[ClassLoader => Unit]) = actions.toSeq map {a => () => a(loader) } val (frameworkSetup, runnables, frameworkCleanup) = - TestFramework.testTasks(frameworks, runners, loader, tests, log, testListeners, arguments) + TestFramework.testTasks(frameworks, runners, loader, tests, log, testListeners) val setupTasks = fj(partApp(userSetup) :+ frameworkSetup) val mainTasks = diff --git a/testing/src/main/scala/sbt/TestFramework.scala b/testing/src/main/scala/sbt/TestFramework.scala index 1d3515233..4638e6199 100644 --- a/testing/src/main/scala/sbt/TestFramework.scala +++ b/testing/src/main/scala/sbt/TestFramework.scala @@ -149,12 +149,10 @@ object TestFramework testLoader: ClassLoader, tests: Seq[TestDefinition], log: Logger, - listeners: Seq[TestReportListener], - testArgsByFramework: Map[Framework, Seq[String]]): + listeners: Seq[TestReportListener]): (() => Unit, Seq[(String, TestFunction)], TestResult.Value => () => Unit) = { - val arguments = testArgsByFramework withDefaultValue Nil - val mappedTests = testMap(frameworks.values.toSeq, tests, arguments) + val mappedTests = testMap(frameworks.values.toSeq, tests) if(mappedTests.isEmpty) (() => (), Nil, _ => () => () ) else @@ -164,8 +162,7 @@ object TestFramework private[this] def order(mapped: Map[String, TestFunction], inputs: Seq[TestDefinition]): Seq[(String, TestFunction)] = for( d <- inputs; act <- mapped.get(d.name) ) yield (d.name, act) - private[this] def testMap(frameworks: Seq[Framework], tests: Seq[TestDefinition], args: Map[Framework, Seq[String]]): - Map[Framework, (Set[TestDefinition], Seq[String])] = + private[this] def testMap(frameworks: Seq[Framework], tests: Seq[TestDefinition]): Map[Framework, Set[TestDefinition]] = { import scala.collection.mutable.{HashMap, HashSet, Set} val map = new HashMap[Framework, Set[TestDefinition]] @@ -180,7 +177,7 @@ object TestFramework } if(!frameworks.isEmpty) assignTests() - map.toMap transform { (framework, tests) => ( mergeDuplicates(framework, tests.toSeq), args(framework)) }; + map.toMap transform { (framework, tests) => mergeDuplicates(framework, tests.toSeq) } } private[this] def mergeDuplicates(framework: Framework, tests: Seq[TestDefinition]): Set[TestDefinition] = { @@ -193,7 +190,7 @@ object TestFramework uniqueDefs.toSet } - private def createTestTasks(loader: ClassLoader, runners: Map[Framework, TestRunner], tests: Map[Framework, (Set[TestDefinition], Seq[String])], ordered: Seq[TestDefinition], log: Logger, listeners: Seq[TestReportListener]) = + private def createTestTasks(loader: ClassLoader, runners: Map[Framework, TestRunner], tests: Map[Framework, Set[TestDefinition]], ordered: Seq[TestDefinition], log: Logger, listeners: Seq[TestReportListener]) = { val testsListeners = listeners collect { case tl: TestsListener => tl } @@ -203,7 +200,7 @@ object TestFramework val startTask = foreachListenerSafe(_.doInit) val testTasks = - tests flatMap { case (framework, (testDefinitions, testArgs)) => + tests flatMap { case (framework, testDefinitions) => val runner = runners(framework) val testTasks = withContextLoader(loader) { runner.tasks(testDefinitions) } for (testTask <- testTasks) yield {