mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-07 11:50:21 +00:00
Port to Python 3.
This commit is contained in:
parent
31ee2e18f3
commit
84a33625bd
@ -1,3 +1,15 @@
|
|||||||
|
"""
|
||||||
|
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
|
||||||
|
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 twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from foolscap.api import flushEventualQueue
|
from foolscap.api import flushEventualQueue
|
||||||
from allmydata.monitor import Monitor
|
from allmydata.monitor import Monitor
|
||||||
@ -22,7 +34,7 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def test_check_no_shares(self):
|
def test_check_no_shares(self):
|
||||||
for shares in self._storage._peers.values():
|
for shares in list(self._storage._peers.values()):
|
||||||
shares.clear()
|
shares.clear()
|
||||||
d = self._fn.check(Monitor())
|
d = self._fn.check(Monitor())
|
||||||
d.addCallback(self.check_bad, "test_check_no_shares")
|
d.addCallback(self.check_bad, "test_check_no_shares")
|
||||||
@ -31,7 +43,7 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
|
|||||||
def test_check_mdmf_no_shares(self):
|
def test_check_mdmf_no_shares(self):
|
||||||
d = self.publish_mdmf()
|
d = self.publish_mdmf()
|
||||||
def _then(ignored):
|
def _then(ignored):
|
||||||
for share in self._storage._peers.values():
|
for share in list(self._storage._peers.values()):
|
||||||
share.clear()
|
share.clear()
|
||||||
d.addCallback(_then)
|
d.addCallback(_then)
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
@ -40,7 +52,7 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
def test_check_not_enough_shares(self):
|
def test_check_not_enough_shares(self):
|
||||||
for shares in self._storage._peers.values():
|
for shares in list(self._storage._peers.values()):
|
||||||
for shnum in list(shares.keys()):
|
for shnum in list(shares.keys()):
|
||||||
if shnum > 0:
|
if shnum > 0:
|
||||||
del shares[shnum]
|
del shares[shnum]
|
||||||
@ -51,7 +63,7 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
|
|||||||
def test_check_mdmf_not_enough_shares(self):
|
def test_check_mdmf_not_enough_shares(self):
|
||||||
d = self.publish_mdmf()
|
d = self.publish_mdmf()
|
||||||
def _then(ignored):
|
def _then(ignored):
|
||||||
for shares in self._storage._peers.values():
|
for shares in list(self._storage._peers.values()):
|
||||||
for shnum in list(shares.keys()):
|
for shnum in list(shares.keys()):
|
||||||
if shnum > 0:
|
if shnum > 0:
|
||||||
del shares[shnum]
|
del shares[shnum]
|
||||||
@ -83,7 +95,7 @@ class Checker(unittest.TestCase, CheckerMixin, PublishMixin):
|
|||||||
# On 8 of the shares, corrupt the beginning of the share data.
|
# On 8 of the shares, corrupt the beginning of the share data.
|
||||||
# The signature check during the servermap update won't catch this.
|
# The signature check during the servermap update won't catch this.
|
||||||
d.addCallback(lambda ignored:
|
d.addCallback(lambda ignored:
|
||||||
corrupt(None, self._storage, "share_data", range(8)))
|
corrupt(None, self._storage, "share_data", list(range(8))))
|
||||||
# On 2 of the shares, corrupt the end of the share data.
|
# On 2 of the shares, corrupt the end of the share data.
|
||||||
# The signature check during the servermap update won't catch
|
# The signature check during the servermap update won't catch
|
||||||
# this either, and the retrieval process will have to process
|
# this either, and the retrieval process will have to process
|
||||||
|
@ -93,6 +93,7 @@ PORTED_MODULES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
PORTED_TEST_MODULES = [
|
PORTED_TEST_MODULES = [
|
||||||
|
"allmydata.test.mutable.test_checker",
|
||||||
"allmydata.test.mutable.test_datahandle",
|
"allmydata.test.mutable.test_datahandle",
|
||||||
"allmydata.test.mutable.test_different_encoding",
|
"allmydata.test.mutable.test_different_encoding",
|
||||||
"allmydata.test.mutable.test_exceptions",
|
"allmydata.test.mutable.test_exceptions",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user