Browse Source

blackbox: Set PYTHONPATH appropriately so scripts in bin/ can find dulwich.

Jelmer Vernooij 14 years ago
parent
commit
bbd081c04f
1 changed files with 8 additions and 3 deletions
  1. 8 3
      dulwich/tests/__init__.py

+ 8 - 3
dulwich/tests/__init__.py

@@ -23,6 +23,8 @@ import doctest
 import os
 import unittest
 import shutil
+import subprocess
+import sys
 import tempfile
 
 try:
@@ -77,9 +79,12 @@ class BlackboxTestCase(TestCase):
         :param name: Name of the command, as it exists in bin/
         :param args: Arguments to the command
         """
-        import subprocess
-        return subprocess.Popen([self.bin_path(name)] + args, stdout=subprocess.PIPE,
-            stdin=subprocess.PIPE, stderr=subprocess.PIPE)
+        env = dict(os.environ)
+        env["PYTHONPATH"] = os.pathsep.join(sys.path)
+        return subprocess.Popen([self.bin_path(name)] + args,
+            stdout=subprocess.PIPE,
+            stdin=subprocess.PIPE, stderr=subprocess.PIPE,
+            env=env)
 
 
 def test_suite():