From 305318a6b2a9cbd638c6c48ce447fb228d7fe47d Mon Sep 17 00:00:00 2001 From: drebs Date: Fri, 30 Jun 2017 09:04:29 -0300 Subject: [test] mark tests that depend on couchdb server --- testing/tests/client/test_deprecated_crypto.py | 2 ++ testing/tests/conftest.py | 8 ++++++++ testing/tests/server/test_server.py | 1 + testing/tests/server/test_shared_db.py | 1 + testing/tests/server/test_url_mapper.py | 2 ++ testing/tests/sync/test_sync.py | 2 ++ testing/tests/sync/test_sync_mutex.py | 2 ++ testing/tests/sync/test_sync_target.py | 5 +++++ 8 files changed, 23 insertions(+) (limited to 'testing/tests') diff --git a/testing/tests/client/test_deprecated_crypto.py b/testing/tests/client/test_deprecated_crypto.py index cdebcb3e..939a2003 100644 --- a/testing/tests/client/test_deprecated_crypto.py +++ b/testing/tests/client/test_deprecated_crypto.py @@ -1,4 +1,5 @@ import json +import pytest from pytest import inlineCallbacks from six.moves.urllib.parse import urljoin @@ -40,6 +41,7 @@ class DeprecatedCryptoTest(SoledadWithCouchServerMixin, TestCaseWithServer): def make_app_with_state(state): return make_token_soledad_app(state) + @pytest.mark.needs_couch @inlineCallbacks def test_touch_updates_remote_representation(self): self.startTwistedServer() diff --git a/testing/tests/conftest.py b/testing/tests/conftest.py index 2459307a..4d88072e 100644 --- a/testing/tests/conftest.py +++ b/testing/tests/conftest.py @@ -16,6 +16,14 @@ from leap.soledad.common.couch import CouchDatabase from leap.soledad.client import Soledad +# mark tests that depend on couchdb +def pytest_collection_modifyitems(items): + marker = getattr(pytest.mark, 'needs_couch') + for item in items: + if 'soledad/testing/tests/couch/' in item.module.__file__: + item.add_marker(marker) + + # # default options for all tests # diff --git a/testing/tests/server/test_server.py b/testing/tests/server/test_server.py index bc80905e..25f0cc2d 100644 --- a/testing/tests/server/test_server.py +++ b/testing/tests/server/test_server.py @@ -40,6 +40,7 @@ from leap.soledad.client import _crypto from leap.soledad.client import Soledad +@pytest.mark.needs_couch @pytest.mark.usefixtures("method_tmpdir") class EncryptedSyncTestCase( CouchDBTestCase, TestCaseWithServer): diff --git a/testing/tests/server/test_shared_db.py b/testing/tests/server/test_shared_db.py index 4f3b1787..96af6dff 100644 --- a/testing/tests/server/test_shared_db.py +++ b/testing/tests/server/test_shared_db.py @@ -28,6 +28,7 @@ from leap.soledad.common.document import SoledadDocument from leap.soledad.common.l2db.errors import RevisionConflict +@pytest.mark.needs_couch class SharedDbTests(unittest.TestCase): """ """ diff --git a/testing/tests/server/test_url_mapper.py b/testing/tests/server/test_url_mapper.py index fa99cae7..a04e7593 100644 --- a/testing/tests/server/test_url_mapper.py +++ b/testing/tests/server/test_url_mapper.py @@ -17,6 +17,7 @@ """ Tests for server-related functionality. """ +import pytest from twisted.trial import unittest from uuid import uuid4 @@ -49,6 +50,7 @@ class URLMapperTestCase(unittest.TestCase): self._urlmap = URLMapper() self._dbname = 'user-%s' % self._uuid + @pytest.mark.needs_couch def test_root_authorized(self): match = self._urlmap.match('/', 'GET') self.assertIsNotNone(match) diff --git a/testing/tests/sync/test_sync.py b/testing/tests/sync/test_sync.py index bce20894..fb9a0245 100644 --- a/testing/tests/sync/test_sync.py +++ b/testing/tests/sync/test_sync.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . import json +import pytest import threading import time @@ -141,6 +142,7 @@ class InterruptableSyncTestCase( return d +@pytest.mark.needs_couch class TestSoledadDbSync( TestWithScenarios, SoledadWithCouchServerMixin, diff --git a/testing/tests/sync/test_sync_mutex.py b/testing/tests/sync/test_sync_mutex.py index a9335973..fdd2aacd 100644 --- a/testing/tests/sync/test_sync_mutex.py +++ b/testing/tests/sync/test_sync_mutex.py @@ -22,6 +22,7 @@ be two concurrent synchronization processes at the same time. """ +import pytest import time import uuid @@ -72,6 +73,7 @@ SoledadSynchronizer.sync = _timed_sync # -- end of monkey-patching +@pytest.mark.needs_couch class TestSyncMutex( BaseSoledadTest, CouchDBTestCase, TestCaseWithServer): diff --git a/testing/tests/sync/test_sync_target.py b/testing/tests/sync/test_sync_target.py index bfa322dc..712f0d3f 100644 --- a/testing/tests/sync/test_sync_target.py +++ b/testing/tests/sync/test_sync_target.py @@ -20,6 +20,7 @@ Test Leap backend bits: sync target import os import time import json +import pytest import random import string import shutil @@ -148,6 +149,7 @@ def make_local_db_and_token_soledad_target( return db, st +@pytest.mark.needs_couch class TestSoledadSyncTarget( TestWithScenarios, SoledadWithCouchServerMixin, @@ -401,6 +403,7 @@ target_scenarios = [ ] +@pytest.mark.needs_couch class SoledadDatabaseSyncTargetTests( TestWithScenarios, SoledadWithCouchServerMixin, @@ -795,6 +798,7 @@ class SyncTimeoutError(Exception): pass +@pytest.mark.needs_couch class TestSoledadDbSync( TestWithScenarios, SoledadWithCouchServerMixin, @@ -952,6 +956,7 @@ class TestSoledadDbSync( return d +@pytest.mark.needs_couch class SQLCipherSyncTargetTests(SoledadDatabaseSyncTargetTests): # TODO: implement _set_trace_hook(_shallow) in SoledadHTTPSyncTarget so -- cgit v1.2.3