mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-01 08:48:01 +00:00
Some tests passing on Python 3.
This commit is contained in:
parent
4a10a2171d
commit
83e16d40a4
@ -224,7 +224,7 @@ class CpOptions(FileStoreOptions):
|
|||||||
def parseArgs(self, *args):
|
def parseArgs(self, *args):
|
||||||
if len(args) < 2:
|
if len(args) < 2:
|
||||||
raise usage.UsageError("cp requires at least two arguments")
|
raise usage.UsageError("cp requires at least two arguments")
|
||||||
self.sources = map(argv_to_unicode, args[:-1])
|
self.sources = list(map(argv_to_unicode, args[:-1]))
|
||||||
self.destination = argv_to_unicode(args[-1])
|
self.destination = argv_to_unicode(args[-1])
|
||||||
|
|
||||||
synopsis = "[options] FROM.. TO"
|
synopsis = "[options] FROM.. TO"
|
||||||
@ -435,7 +435,7 @@ class CheckOptions(FileStoreOptions):
|
|||||||
("add-lease", None, "Add/renew lease on all shares."),
|
("add-lease", None, "Add/renew lease on all shares."),
|
||||||
]
|
]
|
||||||
def parseArgs(self, *locations):
|
def parseArgs(self, *locations):
|
||||||
self.locations = map(argv_to_unicode, locations)
|
self.locations = list(map(argv_to_unicode, locations))
|
||||||
|
|
||||||
synopsis = "[options] [ALIAS:PATH]"
|
synopsis = "[options] [ALIAS:PATH]"
|
||||||
description = """
|
description = """
|
||||||
@ -452,7 +452,7 @@ class DeepCheckOptions(FileStoreOptions):
|
|||||||
("verbose", "v", "Be noisy about what is happening."),
|
("verbose", "v", "Be noisy about what is happening."),
|
||||||
]
|
]
|
||||||
def parseArgs(self, *locations):
|
def parseArgs(self, *locations):
|
||||||
self.locations = map(argv_to_unicode, locations)
|
self.locations = list(map(argv_to_unicode, locations))
|
||||||
|
|
||||||
synopsis = "[options] [ALIAS:PATH]"
|
synopsis = "[options] [ALIAS:PATH]"
|
||||||
description = """
|
description = """
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import urllib
|
from urllib.parse import quote as url_quote
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# Python 2 compatibility
|
# Python 2 compatibility
|
||||||
@ -36,7 +36,7 @@ def check_location(options, where):
|
|||||||
return 1
|
return 1
|
||||||
if path == '/':
|
if path == '/':
|
||||||
path = ''
|
path = ''
|
||||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
url = nodeurl + "uri/%s" % url_quote(rootcap)
|
||||||
if path:
|
if path:
|
||||||
url += "/" + escape_path(path)
|
url += "/" + escape_path(path)
|
||||||
# todo: should it end with a slash?
|
# todo: should it end with a slash?
|
||||||
@ -139,7 +139,7 @@ class DeepCheckOutput(LineOnlyReceiver, object):
|
|||||||
if self.in_error:
|
if self.in_error:
|
||||||
print(quote_output(line, quotemarks=False), file=self.stderr)
|
print(quote_output(line, quotemarks=False), file=self.stderr)
|
||||||
return
|
return
|
||||||
if line.startswith("ERROR:"):
|
if line.startswith(b"ERROR:"):
|
||||||
self.in_error = True
|
self.in_error = True
|
||||||
self.streamer.rc = 1
|
self.streamer.rc = 1
|
||||||
print(quote_output(line, quotemarks=False), file=self.stderr)
|
print(quote_output(line, quotemarks=False), file=self.stderr)
|
||||||
@ -297,7 +297,7 @@ class DeepCheckStreamer(LineOnlyReceiver, object):
|
|||||||
return 1
|
return 1
|
||||||
if path == '/':
|
if path == '/':
|
||||||
path = ''
|
path = ''
|
||||||
url = nodeurl + "uri/%s" % urllib.quote(rootcap)
|
url = nodeurl + "uri/%s" % url_quote(rootcap)
|
||||||
if path:
|
if path:
|
||||||
url += "/" + escape_path(path)
|
url += "/" + escape_path(path)
|
||||||
# todo: should it end with a slash?
|
# todo: should it end with a slash?
|
||||||
|
@ -18,7 +18,7 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
self.basedir = "cli/Check/check"
|
self.basedir = "cli/Check/check"
|
||||||
self.set_up_grid()
|
self.set_up_grid()
|
||||||
c0 = self.g.clients[0]
|
c0 = self.g.clients[0]
|
||||||
DATA = "data" * 100
|
DATA = b"data" * 100
|
||||||
DATA_uploadable = MutableData(DATA)
|
DATA_uploadable = MutableData(DATA)
|
||||||
d = c0.create_mutable_file(DATA_uploadable)
|
d = c0.create_mutable_file(DATA_uploadable)
|
||||||
def _stash_uri(n):
|
def _stash_uri(n):
|
||||||
@ -45,7 +45,7 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
self.failUnlessReallyEqual(data["results"]["healthy"], True)
|
self.failUnlessReallyEqual(data["results"]["healthy"], True)
|
||||||
d.addCallback(_check2)
|
d.addCallback(_check2)
|
||||||
|
|
||||||
d.addCallback(lambda ign: c0.upload(upload.Data("literal", convergence="")))
|
d.addCallback(lambda ign: c0.upload(upload.Data(b"literal", convergence=b"")))
|
||||||
def _stash_lit_uri(n):
|
def _stash_lit_uri(n):
|
||||||
self.lit_uri = n.get_uri()
|
self.lit_uri = n.get_uri()
|
||||||
d.addCallback(_stash_lit_uri)
|
d.addCallback(_stash_lit_uri)
|
||||||
@ -156,14 +156,14 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
c0 = self.g.clients[0]
|
c0 = self.g.clients[0]
|
||||||
self.uris = {}
|
self.uris = {}
|
||||||
self.fileurls = {}
|
self.fileurls = {}
|
||||||
DATA = "data" * 100
|
DATA = b"data" * 100
|
||||||
quoted_good = quote_output(u"g\u00F6\u00F6d")
|
quoted_good = quote_output(u"g\u00F6\u00F6d")
|
||||||
|
|
||||||
d = c0.create_dirnode()
|
d = c0.create_dirnode()
|
||||||
def _stash_root_and_create_file(n):
|
def _stash_root_and_create_file(n):
|
||||||
self.rootnode = n
|
self.rootnode = n
|
||||||
self.rooturi = n.get_uri()
|
self.rooturi = n.get_uri()
|
||||||
return n.add_file(u"g\u00F6\u00F6d", upload.Data(DATA, convergence=""))
|
return n.add_file(u"g\u00F6\u00F6d", upload.Data(DATA, convergence=b""))
|
||||||
d.addCallback(_stash_root_and_create_file)
|
d.addCallback(_stash_root_and_create_file)
|
||||||
def _stash_uri(fn, which):
|
def _stash_uri(fn, which):
|
||||||
self.uris[which] = fn.get_uri()
|
self.uris[which] = fn.get_uri()
|
||||||
@ -171,11 +171,11 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
d.addCallback(_stash_uri, u"g\u00F6\u00F6d")
|
d.addCallback(_stash_uri, u"g\u00F6\u00F6d")
|
||||||
d.addCallback(lambda ign:
|
d.addCallback(lambda ign:
|
||||||
self.rootnode.add_file(u"small",
|
self.rootnode.add_file(u"small",
|
||||||
upload.Data("literal",
|
upload.Data(b"literal",
|
||||||
convergence="")))
|
convergence=b"")))
|
||||||
d.addCallback(_stash_uri, "small")
|
d.addCallback(_stash_uri, "small")
|
||||||
d.addCallback(lambda ign:
|
d.addCallback(lambda ign:
|
||||||
c0.create_mutable_file(MutableData(DATA+"1")))
|
c0.create_mutable_file(MutableData(DATA+b"1")))
|
||||||
d.addCallback(lambda fn: self.rootnode.set_node(u"mutable", fn))
|
d.addCallback(lambda fn: self.rootnode.set_node(u"mutable", fn))
|
||||||
d.addCallback(_stash_uri, "mutable")
|
d.addCallback(_stash_uri, "mutable")
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ class Check(GridTestMixin, CLITestMixin, unittest.TestCase):
|
|||||||
d.addCallback(lambda ign: self.rootnode.create_subdirectory(u"subdir"))
|
d.addCallback(lambda ign: self.rootnode.create_subdirectory(u"subdir"))
|
||||||
d.addCallback(_stash_uri, "subdir")
|
d.addCallback(_stash_uri, "subdir")
|
||||||
d.addCallback(lambda fn:
|
d.addCallback(lambda fn:
|
||||||
fn.add_file(u"subfile", upload.Data(DATA+"2", "")))
|
fn.add_file(u"subfile", upload.Data(DATA+b"2", b"")))
|
||||||
d.addCallback(lambda ign:
|
d.addCallback(lambda ign:
|
||||||
self.delete_shares_numbered(self.uris["subdir"],
|
self.delete_shares_numbered(self.uris["subdir"],
|
||||||
range(10)))
|
range(10)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user