Kaynağa Gözat

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

Jelmer Vernooij 14 yıl önce
ebeveyn
işleme
f3a5c18295
1 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 8 3
      dulwich/tests/__init__.py

+ 8 - 3
dulwich/tests/__init__.py

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