[Zope3-checkins] SVN: zdaemon/trunk/src/zdaemon/tests/ Pass PYTHONPATH to subprocesses. In the new buildout,

Jim Fulton jim at zope.com
Sun Nov 5 12:43:38 EST 2006


Log message for revision 71081:
  Pass PYTHONPATH to subprocesses.  In the new buildout, 
  ZConfig and zope packages aren't siblings of zdaemon and zdruns
  lame path guessting fails.  In a modern world, scripts are generated
  by easy_install or buildout ahnd get paths set automatically.  We
  need to phase out this magic path guessing.
  

Changed:
  U   zdaemon/trunk/src/zdaemon/tests/parent.py
  U   zdaemon/trunk/src/zdaemon/tests/testzdrun.py

-=-
Modified: zdaemon/trunk/src/zdaemon/tests/parent.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/parent.py	2006-11-05 17:43:33 UTC (rev 71080)
+++ zdaemon/trunk/src/zdaemon/tests/parent.py	2006-11-05 17:43:36 UTC (rev 71081)
@@ -27,7 +27,9 @@
     flag = os.P_NOWAIT
     #cmd = ' '.join([sys.executable] + args)
     #print cmd
-    os.spawnvp(flag, args[0], args)
+    os.spawnvpe(flag, args[0], args,
+                dict(os.environ, PYTHONPATH=':'.join(sys.path)),
+                )
     while 1:
         # wait to be signaled
         time.sleep(1)

Modified: zdaemon/trunk/src/zdaemon/tests/testzdrun.py
===================================================================
--- zdaemon/trunk/src/zdaemon/tests/testzdrun.py	2006-11-05 17:43:33 UTC (rev 71080)
+++ zdaemon/trunk/src/zdaemon/tests/testzdrun.py	2006-11-05 17:43:36 UTC (rev 71081)
@@ -233,13 +233,16 @@
         tmp = tempfile.mkdtemp()
         zdrun_socket = os.path.join(tmp, 'testsock')
         try:
-            zdctlpid = os.spawnvp(
+            zdctlpid = os.spawnvpe(
                 os.P_NOWAIT,
                 sys.executable,
-                [sys.executable, os.path.join(self.here, 'parent.py'), tmp]
+                [sys.executable, os.path.join(self.here, 'parent.py'), tmp],
+                dict(os.environ,
+                     PYTHONPATH=":".join(sys.path),
+                     )
                 )
             # Wait for it to start, but no longer than a minute.
-            deadline = time.time() + 60
+            deadline = time.time() + 6000
             is_started = False
             while time.time() < deadline:
                  response = send_action('status\n', zdrun_socket)



More information about the Zope3-Checkins mailing list