mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-19 04:57:54 +00:00
Port test_checker.py to Python 3.
This commit is contained in:
parent
a4ce3b42ef
commit
dd863a003f
@ -1,3 +1,4 @@
|
||||
from past.builtins import unicode
|
||||
|
||||
from zope.interface import implementer
|
||||
from allmydata.interfaces import ICheckResults, ICheckAndRepairResults, \
|
||||
@ -56,7 +57,11 @@ class CheckResults(object):
|
||||
self._list_incompatible_shares = list_incompatible_shares
|
||||
self._count_incompatible_shares = count_incompatible_shares
|
||||
|
||||
assert isinstance(summary, str) # should be a single string
|
||||
# On Python 2, we can mix bytes and Unicode. On Python 3, we want
|
||||
# unicode.
|
||||
if isinstance(summary, bytes):
|
||||
summary = unicode(summary, "utf-8")
|
||||
assert isinstance(summary, unicode) # should be a single string
|
||||
self._summary = summary
|
||||
assert not isinstance(report, str) # should be list of strings
|
||||
self._report = report
|
||||
|
@ -1,5 +1,16 @@
|
||||
"""
|
||||
Ported to Python 3.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from future.utils import PY2
|
||||
from past.builtins import unicode
|
||||
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
|
||||
|
||||
|
||||
import json
|
||||
import os.path, shutil
|
||||
@ -161,7 +172,7 @@ class WebResultsRendering(unittest.TestCase):
|
||||
"service-name": "storage",
|
||||
"anonymous-storage-FURL": furl,
|
||||
"permutation-seed-base32": "",
|
||||
"nickname": unicode(nickname),
|
||||
"nickname": str(nickname),
|
||||
"app-versions": {}, # need #466 and v2 introducer
|
||||
"my-version": "ver",
|
||||
"oldest-supported": "oldest",
|
||||
@ -671,7 +682,7 @@ class BalancingAct(GridTestMixin, unittest.TestCase):
|
||||
"This little printing function is only meant for < 26 servers"
|
||||
shares_chart = {}
|
||||
names = dict(zip([ss.my_nodeid
|
||||
for _,ss in self.g.servers_by_number.iteritems()],
|
||||
for _,ss in self.g.servers_by_number.items()],
|
||||
letters))
|
||||
for shnum, serverid, _ in self.find_uri_shares(uri):
|
||||
shares_chart.setdefault(shnum, []).append(names[serverid])
|
||||
|
@ -89,6 +89,7 @@ PORTED_TEST_MODULES = [
|
||||
"allmydata.test.test_abbreviate",
|
||||
"allmydata.test.test_base32",
|
||||
"allmydata.test.test_base62",
|
||||
"allmydata.test.test_checker",
|
||||
"allmydata.test.test_codec",
|
||||
"allmydata.test.test_common_util",
|
||||
"allmydata.test.test_configutil",
|
||||
|
Loading…
Reference in New Issue
Block a user