1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00
phorge-arcanist/src/unit/engine/PytestTestEngine.php
Aviv Eyal aebcd7a985 Extract xUnit test results parser
Summary:
Many test frameworks can format their output in xUnit-like format.

Test Plan: Tested the Nose engine with a Nose one, and the pytest with a demo project.

Reviewers: epriestley

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D7011

Conflicts:
	src/__phutil_library_map__.php
2013-09-30 10:44:13 -07:00

23 lines
530 B
PHP

<?php
/**
* Very basic 'py.test' unit test engine wrapper.
*
* @group unitrun
*/
final class PytestTestEngine extends ArcanistBaseUnitTestEngine {
public function run() {
$junit_tmp = new TempFile();
$cmd_line = csprintf('py.test --junitxml=%s',
$junit_tmp);
$future = new ExecFuture('%C', $cmd_line);
list($stdout, $stderr) = $future->resolvex();
$parser = new ArcanistXUnitTestResultParser();
return $parser->parseTestResults(Filesystem::readFile($junit_tmp));
}
}