diff --git a/.circleci/config.yml b/.circleci/config.yml index df181f058..56bc3e07e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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: diff --git a/.circleci/run-tests.sh b/.circleci/run-tests.sh index 48f500280..764651c40 100755 --- a/.circleci/run-tests.sh +++ b/.circleci/run-tests.sh @@ -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 diff --git a/newsfragments/3396.minor b/newsfragments/3396.minor new file mode 100644 index 000000000..e69de29bb diff --git a/newsfragments/3401.minor b/newsfragments/3401.minor new file mode 100644 index 000000000..e69de29bb diff --git a/src/allmydata/test/common.py b/src/allmydata/test/common.py index dbd93df67..b69d58ab9 100644 --- a/src/allmydata/test/common.py +++ b/src/allmydata/test/common.py @@ -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, diff --git a/src/allmydata/test/common_py3.py b/src/allmydata/test/common_py3.py index 36738d559..50fb02ff7 100644 --- a/src/allmydata/test/common_py3.py +++ b/src/allmydata/test/common_py3.py @@ -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 diff --git a/src/allmydata/test/test_system.py b/src/allmydata/test/test_system.py index c80aeb45e..96fdfaba7 100644 --- a/src/allmydata/test/test_system.py +++ b/src/allmydata/test/test_system.py @@ -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()