We heard you like test failures so we put unbound locals in your test so that you can fail while you fail.
This commit is contained in:
parent
d10d8ee2a1
commit
c7ca56d213
|
@ -1070,9 +1070,9 @@ else:
|
||||||
ssl_version=ssl.PROTOCOL_TLSv1)
|
ssl_version=ssl.PROTOCOL_TLSv1)
|
||||||
s.connect((HOST, server.port))
|
s.connect((HOST, server.port))
|
||||||
except ssl.SSLError as x:
|
except ssl.SSLError as x:
|
||||||
raise support.TestFailed("Unexpected SSL error: " + str(x))
|
self.fail("Unexpected SSL error: " + str(x))
|
||||||
except Exception as x:
|
except Exception as x:
|
||||||
raise support.TestFailed("Unexpected exception: " + str(x))
|
self.fail("Unexpected exception: " + str(x))
|
||||||
else:
|
else:
|
||||||
# helper methods for standardising recv* method signatures
|
# helper methods for standardising recv* method signatures
|
||||||
def _recv_into():
|
def _recv_into():
|
||||||
|
@ -1106,7 +1106,7 @@ else:
|
||||||
outdata = s.read()
|
outdata = s.read()
|
||||||
outdata = outdata.decode('ASCII', 'strict')
|
outdata = outdata.decode('ASCII', 'strict')
|
||||||
if outdata != indata.lower():
|
if outdata != indata.lower():
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"While sending with <<%s>> bad data "
|
"While sending with <<%s>> bad data "
|
||||||
"<<%r>> (%d) received; "
|
"<<%r>> (%d) received; "
|
||||||
"expected <<%r>> (%d)\n" % (
|
"expected <<%r>> (%d)\n" % (
|
||||||
|
@ -1116,12 +1116,12 @@ else:
|
||||||
)
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if expect_success:
|
if expect_success:
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"Failed to send with method <<%s>>; "
|
"Failed to send with method <<%s>>; "
|
||||||
"expected to succeed.\n" % (meth_name,)
|
"expected to succeed.\n" % (meth_name,)
|
||||||
)
|
)
|
||||||
if not str(e).startswith(meth_name):
|
if not str(e).startswith(meth_name):
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"Method <<%s>> failed with unexpected "
|
"Method <<%s>> failed with unexpected "
|
||||||
"exception message: %s\n" % (
|
"exception message: %s\n" % (
|
||||||
meth_name, e
|
meth_name, e
|
||||||
|
@ -1135,7 +1135,7 @@ else:
|
||||||
outdata = recv_meth(*args)
|
outdata = recv_meth(*args)
|
||||||
outdata = outdata.decode('ASCII', 'strict')
|
outdata = outdata.decode('ASCII', 'strict')
|
||||||
if outdata != indata.lower():
|
if outdata != indata.lower():
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"While receiving with <<%s>> bad data "
|
"While receiving with <<%s>> bad data "
|
||||||
"<<%r>> (%d) received; "
|
"<<%r>> (%d) received; "
|
||||||
"expected <<%r>> (%d)\n" % (
|
"expected <<%r>> (%d)\n" % (
|
||||||
|
@ -1145,12 +1145,12 @@ else:
|
||||||
)
|
)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if expect_success:
|
if expect_success:
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"Failed to receive with method <<%s>>; "
|
"Failed to receive with method <<%s>>; "
|
||||||
"expected to succeed.\n" % (meth_name,)
|
"expected to succeed.\n" % (meth_name,)
|
||||||
)
|
)
|
||||||
if not str(e).startswith(meth_name):
|
if not str(e).startswith(meth_name):
|
||||||
raise support.TestFailed(
|
self.fail(
|
||||||
"Method <<%s>> failed with unexpected "
|
"Method <<%s>> failed with unexpected "
|
||||||
"exception message: %s\n" % (
|
"exception message: %s\n" % (
|
||||||
meth_name, e
|
meth_name, e
|
||||||
|
|
Loading…
Reference in New Issue