1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 18:22:41 +01:00

Remove arguments from unit test engines

Summary: Ref T9131. This doesn't seem to be used... it seems like it is a relic of postponed test results.

Test Plan: N/A

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin

Maniphest Tasks: T9131

Differential Revision: https://secure.phabricator.com/D14487
This commit is contained in:
Joshua Spence 2015-11-15 20:04:59 +00:00 committed by joshuaspence
parent 9dd6eafb52
commit 66ab1c955d
4 changed files with 23 additions and 40 deletions

View file

@ -115,6 +115,9 @@ final class ArcanistConfigurationDrivenUnitTestEngine
} }
public function run() { public function run() {
$renderer = $this->renderer;
$this->setRenderer(null);
$paths = $this->getPaths(); $paths = $this->getPaths();
// If we are running with `--everything` then `$paths` will be `null`. // If we are running with `--everything` then `$paths` will be `null`.
@ -122,14 +125,15 @@ final class ArcanistConfigurationDrivenUnitTestEngine
$paths = array(); $paths = array();
} }
$engines = $this->buildTestEngines(); $engines = $this->buildTestEngines();
$results = array(); $all_results = array();
$exceptions = array(); $exceptions = array();
foreach ($engines as $engine) { foreach ($engines as $engine) {
$engine $engine
->setWorkingCopy($this->getWorkingCopy()) ->setWorkingCopy($this->getWorkingCopy())
->setEnableCoverage($this->getEnableCoverage()); ->setEnableCoverage($this->getEnableCoverage())
->setRenderer($renderer);
// TODO: At some point, maybe we should emit a warning here if an engine // TODO: At some point, maybe we should emit a warning here if an engine
// doesn't support `--everything`, to reduce surprise when `--everything` // doesn't support `--everything`, to reduce surprise when `--everything`
@ -140,19 +144,30 @@ final class ArcanistConfigurationDrivenUnitTestEngine
try { try {
// TODO: Type check the results. // TODO: Type check the results.
$results[] = $engine->run(); $results = $engine->run();
$all_results[] = $results;
foreach ($results as $result) {
if ($engine->shouldEchoTestResults()) {
echo $renderer->renderUnitResult($result);
}
}
} catch (ArcanistNoEffectException $ex) { } catch (ArcanistNoEffectException $ex) {
$exceptions[] = $ex; $exceptions[] = $ex;
} }
} }
if (!$results) { if (!$all_results) {
// If all engines throw an `ArcanistNoEffectException`, then we should // If all engines throw an `ArcanistNoEffectException`, then we should
// preserve this behavior. // preserve this behavior.
throw new ArcanistNoEffectException(pht('No tests to run.')); throw new ArcanistNoEffectException(pht('No tests to run.'));
} }
return array_mergev($results); return array_mergev($all_results);
}
public function shouldEchoTestResults() {
return false;
} }
private function loadAvailableTestEngines() { private function loadAvailableTestEngines() {

View file

@ -7,8 +7,6 @@ abstract class ArcanistUnitTestEngine extends Phobject {
private $workingCopy; private $workingCopy;
private $paths = array(); private $paths = array();
private $arguments = array();
private $enableAsyncTests;
private $enableCoverage; private $enableCoverage;
private $runAllTests; private $runAllTests;
private $configurationManager; private $configurationManager;
@ -71,24 +69,6 @@ abstract class ArcanistUnitTestEngine extends Phobject {
return $this->paths; return $this->paths;
} }
final public function setArguments(array $arguments) {
$this->arguments = $arguments;
return $this;
}
final public function getArgument($key, $default = null) {
return idx($this->arguments, $key, $default);
}
final public function setEnableAsyncTests($enable_async_tests) {
$this->enableAsyncTests = $enable_async_tests;
return $this;
}
final public function getEnableAsyncTests() {
return $this->enableAsyncTests;
}
final public function setEnableCoverage($enable_coverage) { final public function setEnableCoverage($enable_coverage) {
$this->enableCoverage = $enable_coverage; $this->enableCoverage = $enable_coverage;
return $this; return $this;
@ -98,7 +78,7 @@ abstract class ArcanistUnitTestEngine extends Phobject {
return $this->enableCoverage; return $this->enableCoverage;
} }
final public function setRenderer(ArcanistUnitRenderer $renderer) { final public function setRenderer(ArcanistUnitRenderer $renderer = null) {
$this->renderer = $renderer; $this->renderer = $renderer;
return $this; return $this;
} }

View file

@ -221,8 +221,4 @@ final class PhutilUnitTestEngine extends ArcanistUnitTestEngine {
return $paths; return $paths;
} }
public function shouldEchoTestResults() {
return !$this->renderer;
}
} }

View file

@ -151,7 +151,6 @@ EOTEXT
} else { } else {
$this->engine->setPaths($paths); $this->engine->setPaths($paths);
} }
$this->engine->setArguments($this->getPassthruArgumentsAsMap('unit'));
$renderer = new ArcanistUnitConsoleRenderer(); $renderer = new ArcanistUnitConsoleRenderer();
$this->engine->setRenderer($renderer); $this->engine->setRenderer($renderer);
@ -165,13 +164,6 @@ EOTEXT
} }
$this->engine->setEnableCoverage($enable_coverage); $this->engine->setEnableCoverage($enable_coverage);
// Enable possible async tests only for 'arc diff' not 'arc unit'
if ($this->getParentWorkflow()) {
$this->engine->setEnableAsyncTests(true);
} else {
$this->engine->setEnableAsyncTests(false);
}
$results = $this->engine->run(); $results = $this->engine->run();
$this->validateUnitEngineResults($this->engine, $results); $this->validateUnitEngineResults($this->engine, $results);