diff options
-rw-r--r-- | src/leap/soledad/common/couch/state.py | 5 | ||||
-rw-r--r-- | tests/couch/test_state.py | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/leap/soledad/common/couch/state.py b/src/leap/soledad/common/couch/state.py index 38098e3f..5614b32f 100644 --- a/src/leap/soledad/common/couch/state.py +++ b/src/leap/soledad/common/couch/state.py @@ -93,9 +93,8 @@ def _check_db_schema_version(url, db, auth, agent=None): def _stop(failure, reactor): - exception = failure.value.subFailure.value logger.error("Failure while checking schema versions: %r - %s" - % (exception, exception.message)) + % (failure, failure.message)) reactor.addSystemEventTrigger('after', 'shutdown', os._exit, 1) reactor.stop() @@ -124,9 +123,9 @@ def check_schema_versions(couch_url, agent=None, reactor=reactor): if not db.startswith('user-'): continue d = semaphore.run(_check_db_schema_version, url, db, auth, agent=agent) + d.addErrback(_stop, reactor=reactor) deferreds.append(d) d = defer.gatherResults(deferreds, consumeErrors=True) - d.addErrback(_stop, reactor=reactor) yield d diff --git a/tests/couch/test_state.py b/tests/couch/test_state.py index 673d9c41..27db5abe 100644 --- a/tests/couch/test_state.py +++ b/tests/couch/test_state.py @@ -47,7 +47,7 @@ class CouchDesignDocsTests(CouchDBTestCase): mocked_reactor = mock.Mock() yield check_schema_versions( self.couch_url, agent=self.agent, reactor=mocked_reactor) - self.assertTrue(mocked_reactor.stop.call_count == 1) + mocked_reactor.stop.assert_called() @defer.inlineCallbacks def test__check_db_schema_version_missing_config_doc_raises(self): @@ -62,4 +62,4 @@ class CouchDesignDocsTests(CouchDBTestCase): mocked_reactor = mock.Mock() yield check_schema_versions( self.couch_url, agent=self.agent, reactor=mocked_reactor) - self.assertTrue(mocked_reactor.stop.call_count == 1) + mocked_reactor.stop.assert_called() |