[Zope-Checkins] CVS: Releases/Zope/lib/python/zdaemon/tests - testzdaemon.py:1.2

Guido van Rossum guido@python.org
Wed, 13 Nov 2002 10:30:11 -0500


Update of /cvs-repository/Releases/Zope/lib/python/zdaemon/tests
In directory cvs.zope.org:/tmp/cvs-serv13676

Modified Files:
	testzdaemon.py 
Log Message:
Set PYTHONPATH before starting zdaemon as a subprocess, so it works
even if you haven't installed anything.


=== Releases/Zope/lib/python/zdaemon/tests/testzdaemon.py 1.1 => 1.2 ===
--- Releases/Zope/lib/python/zdaemon/tests/testzdaemon.py:1.1	Tue Nov 12 20:18:15 2002
+++ Releases/Zope/lib/python/zdaemon/tests/testzdaemon.py	Wed Nov 13 10:30:10 2002
@@ -22,6 +22,8 @@
     zdaemon = os.path.join(parent, "zdaemon.py")
     assert os.path.exists(zdaemon)
 
+    ppath = os.pathsep.join(sys.path)
+
     def setUp(self):
         self.zdsock = tempfile.mktemp()
         self.new_stdout = StringIO()
@@ -46,8 +48,9 @@
     def rundaemon(self, args):
         if type(args) is type([]):
             args = " ".join(args)
-        os.system("%s %s -d -s %s %s" %
-                  (self.python, self.zdaemon, self.zdsock, args))
+        cmd = ("PYTHONPATH=%s %s %s -d -s %s %s" %
+               (self.ppath, self.python, self.zdaemon, self.zdsock, args))
+        os.system(cmd)
         # When the daemon crashes, the following may help debug it:
         ##os.system("%s %s -s %s %s &" %
         ##          (self.python, self.zdaemon, self.zdsock, args))