mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 13:07:56 +00:00
All tests pass on Python 3.
This commit is contained in:
parent
5e59b9d8d6
commit
f6e0611b07
@ -1,4 +1,5 @@
|
||||
from __future__ import print_function
|
||||
from six import ensure_str
|
||||
|
||||
import os, time
|
||||
from allmydata.scripts.common import get_alias, DEFAULT_ALIAS, escape_path, \
|
||||
@ -14,7 +15,7 @@ class SlowOperationRunner(object):
|
||||
def run(self, options):
|
||||
stderr = options.stderr
|
||||
self.options = options
|
||||
self.ophandle = ophandle = base32.b2a(os.urandom(16))
|
||||
self.ophandle = ophandle = ensure_str(base32.b2a(os.urandom(16)))
|
||||
nodeurl = options['node-url']
|
||||
if not nodeurl.endswith("/"):
|
||||
nodeurl += "/"
|
||||
|
@ -206,7 +206,7 @@ class DeepCheckAndRepairOutput(LineOnlyReceiver, object):
|
||||
if self.in_error:
|
||||
print(quote_output(line, quotemarks=False), file=self.stderr)
|
||||
return
|
||||
if line.startswith("ERROR:"):
|
||||
if line.startswith(b"ERROR:"):
|
||||
self.in_error = True
|
||||
self.streamer.rc = 1
|
||||
print(quote_output(line, quotemarks=False), file=self.stderr)
|
||||
@ -321,12 +321,17 @@ class DeepCheckStreamer(LineOnlyReceiver, object):
|
||||
return 1
|
||||
|
||||
# use Twisted to split this into lines
|
||||
if PY3:
|
||||
stdoutb = stdout.buffer
|
||||
else:
|
||||
stdoutb = stdout
|
||||
|
||||
while True:
|
||||
chunk = resp.read(100)
|
||||
if not chunk:
|
||||
break
|
||||
if self.options["raw"]:
|
||||
stdout.write(chunk)
|
||||
stdoutb.write(chunk)
|
||||
else:
|
||||
output.dataReceived(chunk)
|
||||
if not self.options["raw"]:
|
||||
|
@ -1,6 +1,7 @@
|
||||
from __future__ import print_function
|
||||
|
||||
import urllib, json
|
||||
from urllib.parse import quote as url_quote
|
||||
import json
|
||||
from twisted.protocols.basic import LineOnlyReceiver
|
||||
from allmydata.util.abbreviate import abbreviate_space_both
|
||||
from allmydata.scripts.slow_operation import SlowOperationRunner
|
||||
@ -35,7 +36,7 @@ class ManifestStreamer(LineOnlyReceiver, object):
|
||||
return 1
|
||||
if path == '/':
|
||||
path = ''
|
||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
||||
url = nodeurl + "uri/%s" % url_quote(rootcap)
|
||||
if path:
|
||||
url += "/" + escape_path(path)
|
||||
# todo: should it end with a slash?
|
||||
@ -63,7 +64,7 @@ class ManifestStreamer(LineOnlyReceiver, object):
|
||||
if self.in_error:
|
||||
print(quote_output(line, quotemarks=False), file=stderr)
|
||||
return
|
||||
if line.startswith("ERROR:"):
|
||||
if line.startswith(b"ERROR:"):
|
||||
self.in_error = True
|
||||
self.rc = 1
|
||||
print(quote_output(line, quotemarks=False), file=stderr)
|
||||
|
@ -237,8 +237,8 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
||||
cso.parseOptions([shares[1][2]])
|
||||
storage_index = uri.from_string(self.uris["mutable"]).get_storage_index()
|
||||
self._corrupt_share_line = " corrupt: server %s, SI %s, shnum %d" % \
|
||||
(base32.b2a(shares[1][1]),
|
||||
base32.b2a(storage_index),
|
||||
(unicode(base32.b2a(shares[1][1]), "ascii"),
|
||||
unicode(base32.b2a(storage_index), "ascii"),
|
||||
shares[1][0])
|
||||
debug.corrupt_share(cso)
|
||||
d.addCallback(_clobber_shares)
|
||||
|
Loading…
Reference in New Issue
Block a user