Tests pass on Python 3.

This commit is contained in:
Itamar Turner-Trauring 2021-04-26 09:46:21 -04:00
parent b85d735b8b
commit eb5211672c
3 changed files with 8 additions and 9 deletions

View File

@ -45,10 +45,10 @@ def list(options):
return resp.status
data = resp.read()
if options['json']:
# The webapi server should always output printable ASCII.
if is_printable_ascii(data):
data = unicode(data, "ascii")
print(data, file=stdout)
return 0
else:

View File

@ -1,7 +1,7 @@
from __future__ import print_function
import re
import urllib
from urllib.parse import quote as url_quote
import json
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \
UnknownAliasError
@ -25,7 +25,7 @@ def mv(options, mode="move"):
except UnknownAliasError as e:
e.display(stderr)
return 1
from_url = nodeurl + "uri/%s" % urllib.quote(rootcap)
from_url = nodeurl + "uri/%s" % url_quote(rootcap)
if from_path:
from_url += "/" + escape_path(from_path)
# figure out the source cap
@ -43,7 +43,7 @@ def mv(options, mode="move"):
except UnknownAliasError as e:
e.display(stderr)
return 1
to_url = nodeurl + "uri/%s" % urllib.quote(rootcap)
to_url = nodeurl + "uri/%s" % url_quote(rootcap)
if path:
to_url += "/" + escape_path(path)

View File

@ -99,7 +99,7 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
fn1 = os.path.join(self.basedir, "Metallica")
fn2 = os.path.join(outdir, "Not Metallica")
fn3 = os.path.join(outdir, "test2")
DATA1 = "puppies" * 10000
DATA1 = b"puppies" * 10000
fileutil.write(fn1, DATA1)
d = self.do_cli("create-alias", "tahoe")
@ -264,7 +264,6 @@ class Cp(GridTestMixin, CLITestMixin, unittest.TestCase):
def _get_test_txt_uris(args):
(rc, out, err) = args
self.failUnlessEqual(rc, 0)
import pdb; pdb.set_trace()
filetype, data = json.loads(out)
self.failUnlessEqual(filetype, "filenode")
@ -817,9 +816,9 @@ cp -r $DIRCAP5 $DIRCAP6 to : E9-COLLIDING-TARGETS
"""
class CopyOut(GridTestMixin, CLITestMixin, unittest.TestCase):
FILE_CONTENTS = "file text"
FILE_CONTENTS_5 = "5"
FILE_CONTENTS_6 = "6"
FILE_CONTENTS = b"file text"
FILE_CONTENTS_5 = b"5"
FILE_CONTENTS_6 = b"6"
def do_setup(self):
# first we build a tahoe filesystem that contains: