1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 04:20:55 +01:00

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:
epriestley 2014-12-29 16:15:37 -08:00
parent cb63a4bb6e
commit cea1432782
4 changed files with 12 additions and 0 deletions

View file

@ -15,6 +15,8 @@ final class PhabricatorWorkingCopyDiscoveryTestCase
} }
public function testMercurialCommitDiscovery() { public function testMercurialCommitDiscovery() {
$this->requireBinaryForTest('hg');
$refs = $this->discoverRefs('HT'); $refs = $this->discoverRefs('HT');
$this->assertEqual( $this->assertEqual(
array( array(

View file

@ -10,6 +10,7 @@ final class PhabricatorWorkingCopyPullTestCase
} }
public function testHgPullBasic() { public function testHgPullBasic() {
$this->requireBinaryForTest('hg');
$repo = $this->buildPulledRepository('HT'); $repo = $this->buildPulledRepository('HT');
$this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg')); $this->assertTrue(Filesystem::pathExists($repo->getLocalPath().'/.hg'));

View file

@ -203,6 +203,8 @@ final class PhabricatorChangeParserTestCase
} }
public function testMercurialParser() { public function testMercurialParser() {
$this->requireBinaryForTest('hg');
$repository = $this->buildDiscoveredRepository('CHB'); $repository = $this->buildDiscoveredRepository('CHB');
$viewer = PhabricatorUser::getOmnipotentUser(); $viewer = PhabricatorUser::getOmnipotentUser();

View file

@ -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));
}
}
} }