Changeset View
Changeset View
Standalone View
Standalone View
src/unit/engine/NoseTestEngine.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Very basic 'nose' unit test engine wrapper. | * Very basic 'nose' unit test engine wrapper. | ||||
| * | * | ||||
| * Requires nose 1.1.3 for code coverage. | * Requires nose 1.1.3 for code coverage. | ||||
| * | |||||
| * @group unitrun | |||||
| */ | */ | ||||
| final class NoseTestEngine extends ArcanistBaseUnitTestEngine { | final class NoseTestEngine extends ArcanistBaseUnitTestEngine { | ||||
| public function run() { | public function run() { | ||||
| $paths = $this->getPaths(); | $paths = $this->getPaths(); | ||||
| $affected_tests = array(); | $affected_tests = array(); | ||||
| foreach ($paths as $path) { | foreach ($paths as $path) { | ||||
| $absolute_path = Filesystem::resolvePath($path); | $absolute_path = Filesystem::resolvePath($path); | ||||
| if (is_dir($absolute_path)) { | if (is_dir($absolute_path)) { | ||||
| $absolute_test_path = Filesystem::resolvePath('tests/'.$path); | $absolute_test_path = Filesystem::resolvePath('tests/'.$path); | ||||
| Show All 25 Lines | public function runTests($test_paths, $source_path) { | ||||
| } | } | ||||
| $futures = array(); | $futures = array(); | ||||
| $tmpfiles = array(); | $tmpfiles = array(); | ||||
| foreach ($test_paths as $test_path) { | foreach ($test_paths as $test_path) { | ||||
| $xunit_tmp = new TempFile(); | $xunit_tmp = new TempFile(); | ||||
| $cover_tmp = new TempFile(); | $cover_tmp = new TempFile(); | ||||
| $future = $this->buildTestFuture($test_path, | $future = $this->buildTestFuture($test_path, $xunit_tmp, $cover_tmp); | ||||
| $xunit_tmp, | |||||
| $cover_tmp); | |||||
| $futures[$test_path] = $future; | $futures[$test_path] = $future; | ||||
| $tmpfiles[$test_path] = array( | $tmpfiles[$test_path] = array( | ||||
| 'xunit' => $xunit_tmp, | 'xunit' => $xunit_tmp, | ||||
| 'cover' => $cover_tmp, | 'cover' => $cover_tmp, | ||||
| ); | ); | ||||
| } | } | ||||
| Show All 20 Lines | public function runTests($test_paths, $source_path) { | ||||
| return array_mergev($results); | return array_mergev($results); | ||||
| } | } | ||||
| public function buildTestFuture($path, $xunit_tmp, $cover_tmp) { | public function buildTestFuture($path, $xunit_tmp, $cover_tmp) { | ||||
| $cmd_line = csprintf('nosetests --with-xunit --xunit-file=%s', | $cmd_line = csprintf('nosetests --with-xunit --xunit-file=%s', | ||||
| $xunit_tmp); | $xunit_tmp); | ||||
| if ($this->getEnableCoverage() !== false) { | if ($this->getEnableCoverage() !== false) { | ||||
| $cmd_line .= csprintf(' --with-coverage --cover-xml '. | $cmd_line .= csprintf( | ||||
| '--cover-xml-file=%s', | ' --with-coverage --cover-xml --cover-xml-file=%s', | ||||
| $cover_tmp); | $cover_tmp); | ||||
| } | } | ||||
| return new ExecFuture('%C %s', $cmd_line, $path); | return new ExecFuture('%C %s', $cmd_line, $path); | ||||
| } | } | ||||
| public function parseTestResults($source_path, $xunit_tmp, $cover_tmp) { | public function parseTestResults($source_path, $xunit_tmp, $cover_tmp) { | ||||
| $results = $this->parser->parseTestResults( | $results = $this->parser->parseTestResults( | ||||
| Filesystem::readFile($xunit_tmp)); | Filesystem::readFile($xunit_tmp)); | ||||
| ▲ Show 20 Lines • Show All 63 Lines • Show Last 20 Lines | |||||