r47270 - the other process
hawkowl-TA+aISz0psMTMxyoc4vAAJOcrHinNvQL0E9HWUfgJXw@public.gmane.org Sat, 16 Apr 2016 23:47:51 -0600 (MDT)
| Newsgroups | gmane.comp.python.twisted.commits |
|---|---|
| Message-ID | <[email protected]> |
Author: hawkowl
Date: Sat Apr 16 23:47:47 2016
New Revision: 47270
Modified:
branches/cov-subprocess-8266/twisted/internet/test/test_process.py
branches/cov-subprocess-8266/twisted/test/test_process.py
Log:
the other process
Modified: branches/cov-subprocess-8266/twisted/internet/test/test_process.py
==============================================================================
--- branches/cov-subprocess-8266/twisted/internet/test/test_process.py (original)
+++ branches/cov-subprocess-8266/twisted/internet/test/test_process.py Sat Apr 16 23:47:47 2016
@@ -37,11 +37,16 @@
resource = None
process = None
_uidgidSkip = "Cannot change UID/GID on Windows"
+
+ properEnv = bytesEnviron()
+ properEnv[b"PYTHONPATH"] = os.pathsep.join(sys.path).encode(
+ sys.getfilesystemencoding())
else:
import resource
from twisted.internet import process
if os.getuid() != 0:
_uidgidSkip = "Cannot change UID/GID except as root"
+ properEnv = dict(os.environ)
@@ -597,7 +602,7 @@
"""
usePTY = False
- keepStdioOpenProgram = FilePath(__file__).sibling(b'process_helper.py').path
+ keepStdioOpenProgram = b'twisted.internet.test.process_helper'
if platform.isWindows():
keepStdioOpenArg = b"windows"
else:
@@ -622,12 +627,12 @@
def childConnectionLost(self, childFD):
lost[childFD].callback(None)
- target = FilePath(__file__).sibling(b"process_loseconnection.py")
+ target = b"twisted.internet.test.process_loseconnection"
reactor = self.buildReactor()
reactor.callWhenRunning(
reactor.spawnProcess, Closer(), pyExe,
- [pyExe, target.path], usePTY=self.usePTY)
+ [pyExe, b"-m", target], env=properEnv, usePTY=self.usePTY)
def cbConnected(transport):
transport.write(b'2\n')
@@ -680,9 +685,9 @@
reactor = self.buildReactor()
reactor.callWhenRunning(
reactor.spawnProcess, Ender(), pyExe,
- [pyExe, self.keepStdioOpenProgram, b"child",
+ [pyExe, b"-m", self.keepStdioOpenProgram, b"child",
self.keepStdioOpenArg],
- usePTY=self.usePTY)
+ env=properEnv, usePTY=self.usePTY)
def cbEnded(args):
failure, = args
@@ -728,9 +733,9 @@
reactor = self.buildReactor()
reactor.callWhenRunning(
reactor.spawnProcess, Waiter(), pyExe,
- [pyExe, self.keepStdioOpenProgram, b"child",
+ [pyExe, b"-m", self.keepStdioOpenProgram, b"child",
self.keepStdioOpenArg],
- usePTY=self.usePTY)
+ env=properEnv, usePTY=self.usePTY)
def cbExited(args):
failure, = args
@@ -804,7 +809,7 @@
Arguments given to spawnProcess are passed to the child process as
originally intended.
"""
- us = FilePath(__file__).sibling(b"process_cli.py")
+ us = b"twisted.internet.test.process_cli"
args = [b'hello', b'"', b' \t|<>^&', br'"\\"hello\\"', br'"foo\ bar baz\""']
# Ensure that all non-NUL characters can be passed too.
@@ -829,7 +834,7 @@
def spawnChild():
d = succeed(None)
d.addCallback(lambda dummy: utils.getProcessOutputAndValue(
- pyExe, [us.path] + args, reactor=reactor))
+ pyExe, [b"-m", us] + args, env=properEnv, reactor=reactor))
d.addCallback(processFinished)
d.addBoth(shutdown)
Modified: branches/cov-subprocess-8266/twisted/test/test_process.py
==============================================================================
--- branches/cov-subprocess-8266/twisted/test/test_process.py (original)
+++ branches/cov-subprocess-8266/twisted/test/test_process.py Sat Apr 16 23:47:47 2016
@@ -52,7 +52,6 @@
properEnv = bytesEnviron()
properEnv[b"PYTHONPATH"] = os.pathsep.join(sys.path).encode(
sys.getfilesystemencoding())
-
else:
properEnv = dict(os.environ)