Try to fix Windows failure on Python 3.
This commit is contained in:
parent
8ca6a72396
commit
2c7a4c7e07
|
@ -17,6 +17,7 @@ from six import ensure_text
|
||||||
|
|
||||||
import os.path, re, sys
|
import os.path, re, sys
|
||||||
from os import linesep
|
from os import linesep
|
||||||
|
import locale
|
||||||
|
|
||||||
from eliot import (
|
from eliot import (
|
||||||
log_call,
|
log_call,
|
||||||
|
@ -92,6 +93,10 @@ def run_bintahoe(extra_argv, python_options=None):
|
||||||
argv.extend(extra_argv)
|
argv.extend(extra_argv)
|
||||||
argv = list(unicode_to_argv(arg) for arg in argv)
|
argv = list(unicode_to_argv(arg) for arg in argv)
|
||||||
p = Popen(argv, stdout=PIPE, stderr=PIPE)
|
p = Popen(argv, stdout=PIPE, stderr=PIPE)
|
||||||
|
if PY2:
|
||||||
|
encoding = "utf-8"
|
||||||
|
else:
|
||||||
|
encoding = locale.getpreferredencoding(False)
|
||||||
out = p.stdout.read().decode("utf-8")
|
out = p.stdout.read().decode("utf-8")
|
||||||
err = p.stderr.read().decode("utf-8")
|
err = p.stderr.read().decode("utf-8")
|
||||||
returncode = p.wait()
|
returncode = p.wait()
|
||||||
|
@ -103,7 +108,7 @@ class BinTahoe(common_util.SignalMixin, unittest.TestCase):
|
||||||
"""
|
"""
|
||||||
The runner script receives unmangled non-ASCII values in argv.
|
The runner script receives unmangled non-ASCII values in argv.
|
||||||
"""
|
"""
|
||||||
tricky = u"\u2621"
|
tricky = u"\u00F6"
|
||||||
out, err, returncode = run_bintahoe([tricky])
|
out, err, returncode = run_bintahoe([tricky])
|
||||||
self.assertEqual(returncode, 1)
|
self.assertEqual(returncode, 1)
|
||||||
self.assertIn(u"Unknown command: " + tricky, out)
|
self.assertIn(u"Unknown command: " + tricky, out)
|
||||||
|
|
Loading…
Reference in New Issue