Browse Source

Find binaries to run during blackbox tests in system paths as well.

Jelmer Vernooij 10 years ago
parent
commit
f05ce7cc56
1 changed files with 9 additions and 3 deletions
  1. 9 3
      dulwich/tests/__init__.py

+ 9 - 3
dulwich/tests/__init__.py

@@ -75,8 +75,9 @@ class TestCase(_TestCase):
 class BlackboxTestCase(TestCase):
     """Blackbox testing."""
 
-    bin_directory = os.path.abspath(os.path.join(os.path.dirname(__file__),
-        "..", "..", "bin"))
+    # TODO(jelmer): Include more possible binary paths.
+    bin_directories = [os.path.abspath(os.path.join(os.path.dirname(__file__),
+        "..", "..", "bin")), '/usr/bin', '/usr/local/bin']
 
     def bin_path(self, name):
         """Determine the full path of a binary.
@@ -84,7 +85,12 @@ class BlackboxTestCase(TestCase):
         :param name: Name of the script
         :return: Full path
         """
-        return os.path.join(self.bin_directory, name)
+        for d in self.bin_directories:
+            p = os.path.join(d, name)
+            if os.path.isfile(p):
+                return p
+        else:
+            raise SkipTest("Unable to find binary %s" % name)
 
     def run_command(self, name, args):
         """Run a Dulwich command.