1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 10:12: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() {
$renderer = $this->renderer;
$this->setRenderer(null);
$paths = $this->getPaths();
// If we are running with `--everything` then `$paths` will be `null`.
@ -122,14 +125,15 @@ final class ArcanistConfigurationDrivenUnitTestEngine
$paths = array();
}
$engines = $this->buildTestEngines();
$results = array();
$exceptions = array();
$engines = $this->buildTestEngines();
$all_results = array();
$exceptions = array();
foreach ($engines as $engine) {
$engine
->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
// doesn't support `--everything`, to reduce surprise when `--everything`
@ -140,19 +144,30 @@ final class ArcanistConfigurationDrivenUnitTestEngine
try {
// 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) {
$exceptions[] = $ex;
}
}
if (!$results) {
if (!$all_results) {
// If all engines throw an `ArcanistNoEffectException`, then we should
// preserve this behavior.
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() {

View file

@ -7,8 +7,6 @@ abstract class ArcanistUnitTestEngine extends Phobject {
private $workingCopy;
private $paths = array();
private $arguments = array();
private $enableAsyncTests;
private $enableCoverage;
private $runAllTests;
private $configurationManager;
@ -71,24 +69,6 @@ abstract class ArcanistUnitTestEngine extends Phobject {
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) {
$this->enableCoverage = $enable_coverage;
return $this;
@ -98,7 +78,7 @@ abstract class ArcanistUnitTestEngine extends Phobject {
return $this->enableCoverage;
}
final public function setRenderer(ArcanistUnitRenderer $renderer) {
final public function setRenderer(ArcanistUnitRenderer $renderer = null) {
$this->renderer = $renderer;
return $this;
}

View file

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

View file

@ -151,7 +151,6 @@ EOTEXT
} else {
$this->engine->setPaths($paths);
}
$this->engine->setArguments($this->getPassthruArgumentsAsMap('unit'));
$renderer = new ArcanistUnitConsoleRenderer();
$this->engine->setRenderer($renderer);
@ -165,13 +164,6 @@ EOTEXT
}
$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();
$this->validateUnitEngineResults($this->engine, $results);