Merge pull request #1040 from tahoe-lafs/3675.byteswarning-as-error-again

Make byteswarning an error in Python 3 tests again

Fixes ticket:3675
This commit is contained in:
Itamar Turner-Trauring 2021-04-16 11:20:18 -04:00 committed by GitHub
commit 31e64d2211
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

0
newsfragments/3675.minor Normal file
View File

View File

@ -36,7 +36,7 @@ from foolscap.logging.incident import IncidentQualifier
if PY3: if PY3:
# Error on BytesWarnings, to catch things like str(b""), but only for # Error on BytesWarnings, to catch things like str(b""), but only for
# allmydata code. # allmydata code.
warnings.filterwarnings("error", category=BytesWarning, module="allmydata.*") warnings.filterwarnings("error", category=BytesWarning, module=".*allmydata.*")
class NonQualifier(IncidentQualifier, object): class NonQualifier(IncidentQualifier, object):

View File

@ -1304,7 +1304,7 @@ class MyShare(object):
self._dyhb_rtt = rtt self._dyhb_rtt = rtt
def __repr__(self): def __repr__(self):
return "sh%d-on-%s" % (self._shnum, self._server.get_name()) return "sh%d-on-%s" % (self._shnum, str(self._server.get_name(), "ascii"))
class MySegmentFetcher(SegmentFetcher): class MySegmentFetcher(SegmentFetcher):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -1383,7 +1383,7 @@ class Selection(unittest.TestCase):
self.failUnless(node.failed) self.failUnless(node.failed)
self.failUnless(node.failed.check(NotEnoughSharesError)) self.failUnless(node.failed.check(NotEnoughSharesError))
sname = serverA.get_name() sname = serverA.get_name()
self.failUnlessIn("complete= pending=sh0-on-%s overdue= unused=" % sname, self.failUnlessIn("complete= pending=sh0-on-%s overdue= unused=" % str(sname, "ascii"),
str(node.failed)) str(node.failed))
d.addCallback(_check2) d.addCallback(_check2)
return d return d
@ -1605,7 +1605,7 @@ class Selection(unittest.TestCase):
self.failUnless(node.failed) self.failUnless(node.failed)
self.failUnless(node.failed.check(NotEnoughSharesError)) self.failUnless(node.failed.check(NotEnoughSharesError))
sname = servers[b"peer-2"].get_name() sname = servers[b"peer-2"].get_name()
self.failUnlessIn("complete=sh0 pending= overdue=sh2-on-%s unused=" % sname, self.failUnlessIn("complete=sh0 pending= overdue=sh2-on-%s unused=" % str(sname, "ascii"),
str(node.failed)) str(node.failed))
d.addCallback(_check4) d.addCallback(_check4)
return d return d

View File

@ -515,7 +515,7 @@ class RunNode(common_util.SignalMixin, unittest.TestCase, pollmixin.PollMixin):
0, 0,
"Expected error message from '{}', got something else: {}".format( "Expected error message from '{}', got something else: {}".format(
description, description,
p.get_buffered_output(), str(p.get_buffered_output(), "utf-8"),
), ),
) )