mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 05:28:04 +00:00
Merge remote-tracking branch 'origin/master' into 3397.test-storage-python-3
This commit is contained in:
commit
59f3a471cb
@ -211,7 +211,8 @@ jobs:
|
||||
|
||||
environment:
|
||||
<<: *UTF_8_ENVIRONMENT
|
||||
TAHOE_LAFS_TOX_ENVIRONMENT: "pypy27-coverage"
|
||||
# We don't do coverage since it makes PyPy far too slow:
|
||||
TAHOE_LAFS_TOX_ENVIRONMENT: "pypy27"
|
||||
|
||||
|
||||
c-locale:
|
||||
|
@ -68,6 +68,10 @@ export SUBUNITREPORTER_OUTPUT_PATH="${SUBUNIT2}"
|
||||
export TAHOE_LAFS_TRIAL_ARGS="${TAHOE_LAFS_TRIAL_ARGS:---reporter=subunitv2-file --rterrors}"
|
||||
export PIP_NO_INDEX="1"
|
||||
|
||||
# Make output unbuffered, so progress reports from subunitv2-file get streamed
|
||||
# and notify CircleCI we're still alive.
|
||||
export PYTHONUNBUFFERED=1
|
||||
|
||||
if [ "${ALLOWED_FAILURE}" = "yes" ]; then
|
||||
alternative="true"
|
||||
else
|
||||
|
0
newsfragments/3396.minor
Normal file
0
newsfragments/3396.minor
Normal file
0
newsfragments/3401.minor
Normal file
0
newsfragments/3401.minor
Normal file
@ -52,7 +52,6 @@ from twisted.internet.defer import inlineCallbacks, returnValue
|
||||
from twisted.internet.interfaces import IPullProducer
|
||||
from twisted.python import failure
|
||||
from twisted.python.filepath import FilePath
|
||||
from twisted.application import service
|
||||
from twisted.web.error import Error as WebError
|
||||
from twisted.internet.interfaces import (
|
||||
IStreamServerEndpointStringParser,
|
||||
|
@ -79,6 +79,28 @@ class ShouldFailMixin(object):
|
||||
|
||||
def shouldFail(self, expected_failure, which, substring,
|
||||
callable, *args, **kwargs):
|
||||
"""Assert that a function call raises some exception. This is a
|
||||
Deferred-friendly version of TestCase.assertRaises() .
|
||||
|
||||
Suppose you want to verify the following function:
|
||||
|
||||
def broken(a, b, c):
|
||||
if a < 0:
|
||||
raise TypeError('a must not be negative')
|
||||
return defer.succeed(b+c)
|
||||
|
||||
You can use:
|
||||
d = self.shouldFail(TypeError, 'test name',
|
||||
'a must not be negative',
|
||||
broken, -4, 5, c=12)
|
||||
in your test method. The 'test name' string will be included in the
|
||||
error message, if any, because Deferred chains frequently make it
|
||||
difficult to tell which assertion was tripped.
|
||||
|
||||
The substring= argument, if not None, must appear in the 'repr'
|
||||
of the message wrapped by this Failure, or the test will fail.
|
||||
"""
|
||||
|
||||
assert substring is None or isinstance(substring, (bytes, unicode))
|
||||
d = defer.maybeDeferred(callable, *args, **kwargs)
|
||||
def done(res):
|
||||
@ -143,44 +165,3 @@ class LoggingServiceParent(service.MultiService):
|
||||
def log(self, *args, **kwargs):
|
||||
return log.msg(*args, **kwargs)
|
||||
|
||||
|
||||
class ShouldFailMixin(object):
|
||||
def shouldFail(self, expected_failure, which, substring,
|
||||
callable, *args, **kwargs):
|
||||
"""Assert that a function call raises some exception. This is a
|
||||
Deferred-friendly version of TestCase.assertRaises() .
|
||||
|
||||
Suppose you want to verify the following function:
|
||||
|
||||
def broken(a, b, c):
|
||||
if a < 0:
|
||||
raise TypeError('a must not be negative')
|
||||
return defer.succeed(b+c)
|
||||
|
||||
You can use:
|
||||
d = self.shouldFail(TypeError, 'test name',
|
||||
'a must not be negative',
|
||||
broken, -4, 5, c=12)
|
||||
in your test method. The 'test name' string will be included in the
|
||||
error message, if any, because Deferred chains frequently make it
|
||||
difficult to tell which assertion was tripped.
|
||||
|
||||
The substring= argument, if not None, must appear in the 'repr'
|
||||
of the message wrapped by this Failure, or the test will fail.
|
||||
"""
|
||||
|
||||
assert substring is None or isinstance(substring, str)
|
||||
d = defer.maybeDeferred(callable, *args, **kwargs)
|
||||
def done(res):
|
||||
if isinstance(res, failure.Failure):
|
||||
res.trap(expected_failure)
|
||||
if substring:
|
||||
message = repr(res.value.args[0])
|
||||
self.failUnless(substring in message,
|
||||
"%s: substring '%s' not in '%s'"
|
||||
% (which, substring, message))
|
||||
else:
|
||||
self.fail("%s was supposed to raise %s, not get '%s'" %
|
||||
(which, expected_failure, res))
|
||||
d.addBoth(done)
|
||||
return d
|
||||
|
@ -980,6 +980,8 @@ class CountingDataUploadable(upload.Data):
|
||||
|
||||
class SystemTest(SystemTestMixin, RunBinTahoeMixin, unittest.TestCase):
|
||||
|
||||
timeout = 180
|
||||
|
||||
def test_connections(self):
|
||||
self.basedir = "system/SystemTest/test_connections"
|
||||
d = self.set_up_nodes()
|
||||
|
Loading…
Reference in New Issue
Block a user