r47271 - fix

hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org Sat, 16 Apr 2016 23:56:30 -0600 (MDT)
Newsgroups gmane.comp.python.twisted.commits
Message-ID <[email protected]>
Author: hawkowl
Date: Sat Apr 16 23:56:26 2016
New Revision: 47271

Modified:
   branches/cov-subprocess-8266/twisted/test/test_stdio.py

Log:
fix

Modified: branches/cov-subprocess-8266/twisted/test/test_stdio.py
==============================================================================
--- branches/cov-subprocess-8266/twisted/test/test_stdio.py	(original)
+++ branches/cov-subprocess-8266/twisted/test/test_stdio.py	Sat Apr 16 23:56:26 2016
@@ -15,7 +15,7 @@
 from twisted.python import filepath, log
 from twisted.python.reflect import requireModule
 from twisted.python.runtime import platform
-from twisted.python.compat import xrange, intToBytes
+from twisted.python.compat import xrange, intToBytes, bytesEnviron
 from twisted.internet import error, defer, protocol, stdio, reactor
 from twisted.test.test_tcp import ConnectionLostNotifyingProtocol
 
@@ -32,6 +32,11 @@
     if requireModule('win32process') is None:
         skipWindowsNopywin32 = ("On windows, spawnProcess is not available "
                                 "in the absence of win32process.")
+    properEnv = dict(os.environ)
+else:
+    properEnv = bytesEnviron()
+    properEnv[b"PYTHONPATH"] = os.pathsep.join(sys.path).encode(
+        sys.getfilesystemencoding())
 
 
 class StandardIOTestProcessProtocol(protocol.ProcessProtocol):
@@ -102,8 +107,6 @@
 
         @return: The L{IProcessTransport} provider for the spawned process.
         """
-        import twisted
-        subenv = dict(os.environ)
         args = [sys.executable,
                 b"-m", b"twisted.test." + sibling,
                 reactor.__class__.__module__] + list(args)
@@ -111,7 +114,7 @@
             proto,
             sys.executable,
             args,
-            env=subenv,
+            env=properEnv,
             **kw)