mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-20 03:36:25 +00:00
Make test_runner and test_windows both use the good Popen
This commit is contained in:
parent
73110f48da
commit
c6d108ddb2
@ -9,6 +9,10 @@ __all__ = [
|
||||
"flush_logged_errors",
|
||||
"skip",
|
||||
"skipIf",
|
||||
|
||||
# Selected based on platform and re-exported for convenience.
|
||||
"Popen",
|
||||
"PIPE",
|
||||
]
|
||||
|
||||
from past.builtins import chr as byteschr, unicode
|
||||
@ -48,6 +52,9 @@ from testtools.twistedsupport import (
|
||||
flush_logged_errors,
|
||||
)
|
||||
|
||||
from twisted.python.runtime import (
|
||||
platform,
|
||||
)
|
||||
from twisted.application import service
|
||||
from twisted.plugin import IPlugin
|
||||
from twisted.internet import defer
|
||||
@ -101,6 +108,21 @@ from .eliotutil import (
|
||||
)
|
||||
from .common_util import ShouldFailMixin # noqa: F401
|
||||
|
||||
if platform.isWindows():
|
||||
# Python 2.7 doesn't have good options for launching a process with
|
||||
# non-ASCII in its command line. So use this alternative that does a
|
||||
# better job. However, only use it on Windows because it doesn't work
|
||||
# anywhere else.
|
||||
from ._win_subprocess import (
|
||||
PIPE,
|
||||
Popen,
|
||||
)
|
||||
else:
|
||||
from subprocess import (
|
||||
PIPE,
|
||||
Popen,
|
||||
)
|
||||
|
||||
|
||||
TEST_RSA_KEY_SIZE = 522
|
||||
|
||||
|
@ -5,10 +5,6 @@ from __future__ import (
|
||||
|
||||
import os.path, re, sys
|
||||
from os import linesep
|
||||
from subprocess import (
|
||||
PIPE,
|
||||
Popen,
|
||||
)
|
||||
|
||||
from eliot import (
|
||||
log_call,
|
||||
@ -29,7 +25,14 @@ from twisted.python.runtime import (
|
||||
from allmydata.util import fileutil, pollmixin
|
||||
from allmydata.test import common_util
|
||||
import allmydata
|
||||
from .common_util import parse_cli, run_cli
|
||||
from .common import (
|
||||
PIPE,
|
||||
Popen,
|
||||
)
|
||||
from .common_util import (
|
||||
parse_cli,
|
||||
run_cli,
|
||||
)
|
||||
from .cli_node_api import (
|
||||
CLINodeAPI,
|
||||
Expect,
|
||||
|
@ -29,11 +29,6 @@ from json import (
|
||||
from textwrap import (
|
||||
dedent,
|
||||
)
|
||||
from subprocess import (
|
||||
PIPE,
|
||||
Popen,
|
||||
)
|
||||
|
||||
from twisted.python.filepath import (
|
||||
FilePath,
|
||||
)
|
||||
@ -66,6 +61,8 @@ from hypothesis.strategies import (
|
||||
)
|
||||
|
||||
from .common import (
|
||||
PIPE,
|
||||
Popen,
|
||||
SyncTestCase,
|
||||
)
|
||||
|
||||
@ -132,13 +129,6 @@ class GetArgvTests(SyncTestCase):
|
||||
``get_argv`` returns a list representing the result of tokenizing the
|
||||
"command line" argument string provided to Windows processes.
|
||||
"""
|
||||
# Python 2.7 doesn't have good options for launching a process with
|
||||
# non-ASCII in its command line. So use this alternative that does a
|
||||
# better job. Bury the import here because it only works on Windows.
|
||||
from ._win_subprocess import (
|
||||
Popen
|
||||
)
|
||||
|
||||
working_path = FilePath(self.mktemp())
|
||||
working_path.makedirs()
|
||||
save_argv_path = working_path.child("script.py")
|
||||
|
Loading…
Reference in New Issue
Block a user