diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-06-06 14:11:24 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-06-06 14:11:24 -0300 |
commit | 03b4ed07d1c55770d9c5b0ed8e7d42dd08f80272 (patch) | |
tree | 1c57c8e0076e5be7b2d34ca085a4a04a0e681c4f /common/src/leap/soledad/common/tests/test_couch.py | |
parent | 5cb40a959af827e4eadde1c047664c4f4c0ae01d (diff) | |
parent | 4dc1cd8662a34893051d2f520b73a0bd0774215c (diff) |
Merge branch 'release-0.5.2'0.5.2
Diffstat (limited to 'common/src/leap/soledad/common/tests/test_couch.py')
-rw-r--r-- | common/src/leap/soledad/common/tests/test_couch.py | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/common/src/leap/soledad/common/tests/test_couch.py b/common/src/leap/soledad/common/tests/test_couch.py index 17d4a519..3b1e5a06 100644 --- a/common/src/leap/soledad/common/tests/test_couch.py +++ b/common/src/leap/soledad/common/tests/test_couch.py @@ -219,7 +219,6 @@ def copy_couch_database_for_test(test, db): new_couch_db.put_attachment(new_doc, att, filename=att_name) # cleanup connections to prevent file descriptor leaking - session.close_connections() return new_db @@ -249,13 +248,10 @@ class CouchTests(test_backends.AllDatabaseTests, CouchDBTestCase): # if current test is `test_close` we have to use saved objects to # delete the database because the close() method will have removed the # references needed to do it using the CouchDatabase. - if self.id() == \ - 'leap.soledad.common.tests.test_couch.CouchTests.' \ - 'test_close(couch)': + if self.id().endswith('test_couch.CouchTests.test_close(couch)'): session = couch.Session() server = Server(url=self._url, session=session) del(server[self._dbname]) - session.close_connections() else: self.db.delete_database() test_backends.AllDatabaseTests.tearDown(self) @@ -365,8 +361,6 @@ class CouchDatabaseSyncTargetTests(test_sync.DatabaseSyncTargetTests, # The following tests need that the database have an index, so we fake one. -old_class = couch.CouchDatabase - from u1db.backends.inmemory import InMemoryIndex @@ -444,7 +438,12 @@ class IndexedCouchDatabase(couch.CouchDatabase): return list(set([tuple(key.split('\x01')) for key in keys])) -couch.CouchDatabase = IndexedCouchDatabase +# monkey patch CouchDatabase (once) to include virtual indexes +if getattr(couch.CouchDatabase, '_old_class', None) is None: + old_class = couch.CouchDatabase + IndexedCouchDatabase._old_class = old_class + couch.CouchDatabase = IndexedCouchDatabase + sync_scenarios = [] for name, scenario in COUCH_SCENARIOS: |