mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-08 03:14:21 +00:00
Merge pull request #1057 from tahoe-lafs/3704-tahoe-get-regression
Fix `tahoe get` regression. Fixes ticket:3704
This commit is contained in:
commit
32e82a5a48
0
newsfragments/3704.minor
Normal file
0
newsfragments/3704.minor
Normal file
@ -1,5 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
from future.utils import PY3
|
||||
|
||||
from urllib.parse import quote as url_quote
|
||||
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \
|
||||
UnknownAliasError
|
||||
@ -32,7 +34,7 @@ def get(options):
|
||||
outf = stdout
|
||||
# Make sure we can write bytes; on Python 3 stdout is Unicode by
|
||||
# default.
|
||||
if getattr(outf, "encoding", None) is not None:
|
||||
if PY3 and getattr(outf, "encoding", None) is not None:
|
||||
outf = outf.buffer
|
||||
while True:
|
||||
data = resp.read(4096)
|
||||
|
@ -10,7 +10,7 @@ from future.utils import PY2
|
||||
if PY2:
|
||||
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
|
||||
|
||||
from six import ensure_str
|
||||
from six import ensure_text
|
||||
from six.moves import StringIO
|
||||
import os.path
|
||||
from twisted.trial import unittest
|
||||
@ -182,7 +182,7 @@ class CreateAlias(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
(rc, out, err) = args
|
||||
self.failUnlessReallyEqual(rc, 0)
|
||||
self.assertEqual(len(err), 0, err)
|
||||
self.failUnlessIn(ensure_str("Alias %s created") % quote_output(etudes_arg), out)
|
||||
self.failUnlessIn(u"Alias %s created" % ensure_text(quote_output(etudes_arg)), out)
|
||||
|
||||
aliases = get_aliases(self.get_clientdir())
|
||||
self.failUnless(aliases[u"\u00E9tudes"].startswith(b"URI:DIR2:"))
|
||||
|
@ -105,9 +105,15 @@ def run_cli_native(verb, *args, **kwargs):
|
||||
# necessary. This works okay for ASCII and if LANG is set
|
||||
# appropriately. These aren't great constraints so we should move
|
||||
# away from this behavior.
|
||||
#
|
||||
# The encoding attribute doesn't change StringIO behavior on Python 2,
|
||||
# but it's there for realism of the emulation.
|
||||
stdin = StringIO(stdin)
|
||||
stdin.encoding = encoding
|
||||
stdout = StringIO()
|
||||
stdout.encoding = encoding
|
||||
stderr = StringIO()
|
||||
stderr.encoding = encoding
|
||||
else:
|
||||
# The new behavior, the Python 3 behavior, is to accept unicode and
|
||||
# encode it using a specific encoding. For older versions of Python 3,
|
||||
|
3
tox.ini
3
tox.ini
@ -3,7 +3,8 @@
|
||||
# test suite on all supported python versions. To use it, "pip install tox"
|
||||
# and then run "tox" from this directory.
|
||||
|
||||
# Map Python versions in GitHub Actions to tox environments to run.
|
||||
# Map Python versions in GitHub Actions to tox environments to run, for use by
|
||||
# the tox-gh-actions package.
|
||||
[gh-actions]
|
||||
python =
|
||||
2.7: py27-coverage,codechecks
|
||||
|
Loading…
x
Reference in New Issue
Block a user