Skip Mercurial tests if hg is not present
Summary: I don't have `hg` yet on my new laptop; we should just skip tests if the user is missing binaries. Add a convenience method to do this. Test Plan: Got clean `arc unit --everything` with no `hg` installed. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D11051
This commit is contained in:
@@ -15,6 +15,8 @@ final class PhabricatorWorkingCopyDiscoveryTestCase
|
||||
}
|
||||
|
||||
public function testMercurialCommitDiscovery() {
|
||||
$this->requireBinaryForTest('hg');
|
||||
|
||||
$refs = $this->discoverRefs('HT');
|
||||
$this->assertEqual(
|
||||
array(
|
||||
|
||||
@@ -10,6 +10,7 @@ final class PhabricatorWorkingCopyPullTestCase
|
||||
}
|
||||
|
||||
public function testHgPullBasic() {
|
||||
$this->requireBinaryForTest('hg');
|
||||
$repo = $this->buildPulledRepository('HT');
|
||||
|
||||
$this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg'));
|
||||
|
||||
@@ -203,6 +203,8 @@ final class PhabricatorChangeParserTestCase
|
||||
}
|
||||
|
||||
public function testMercurialParser() {
|
||||
$this->requireBinaryForTest('hg');
|
||||
|
||||
$repository = $this->buildDiscoveredRepository('CHB');
|
||||
$viewer = PhabricatorUser::getOmnipotentUser();
|
||||
|
||||
|
||||
@@ -218,5 +218,12 @@ abstract class PhabricatorTestCase extends ArcanistPhutilTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
protected function requireBinaryForTest($binary) {
|
||||
if (!Filesystem::binaryExists($binary)) {
|
||||
$this->assertSkipped(
|
||||
pht('No binary "%s" found on this system, skipping test.', $binary));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user