浏览代码

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

Jelmer Vernooij 14 年之前
父节点
当前提交
f3a5c18295
共有 1 个文件被更改,包括 8 次插入3 次删除
  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():