From b2422dbea6ba2bbbbd3d758b6cf5741a4c2cfc8b Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Wed, 18 Jan 2017 20:37:54 +0100 Subject: [PATCH] Reorganize testsuite The end goal here is to independently measure coverage of each of those testsuites. --- setup.cfg | 1 + tests/system/cli/__init__.py | 0 tests/{ => system}/cli/conftest.py | 0 tests/{ => system}/cli/test_config.py | 0 tests/{ => system}/cli/test_discover.py | 0 tests/{ => system}/cli/test_fetchparams.py | 0 tests/{ => system}/cli/test_repair.py | 0 tests/{ => system}/cli/test_sync.py | 0 tests/{ => system}/cli/test_utils.py | 0 tests/{ => system}/utils/test_main.py | 0 tests/{ => unit}/test_metasync.py | 4 ++-- tests/{ => unit}/test_repair.py | 3 +-- tests/{ => unit}/test_sync.py | 4 ++-- tests/{ => unit}/utils/test_vobject.py | 5 +++-- tests/utils/__init__.py | 1 - 15 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 tests/system/cli/__init__.py rename tests/{ => system}/cli/conftest.py (100%) rename tests/{ => system}/cli/test_config.py (100%) rename tests/{ => system}/cli/test_discover.py (100%) rename tests/{ => system}/cli/test_fetchparams.py (100%) rename tests/{ => system}/cli/test_repair.py (100%) rename tests/{ => system}/cli/test_sync.py (100%) rename tests/{ => system}/cli/test_utils.py (100%) rename tests/{ => system}/utils/test_main.py (100%) rename tests/{ => unit}/test_metasync.py (99%) rename tests/{ => unit}/test_repair.py (97%) rename tests/{ => unit}/test_sync.py (99%) rename tests/{ => unit}/utils/test_vobject.py (98%) delete mode 100644 tests/utils/__init__.py diff --git a/setup.cfg b/setup.cfg index d0c3600..92b76d4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,3 +8,4 @@ norecursedirs = tests/storage/servers/* # W503: Line break before operator ignore = W503, E731 exclude = tests/storage/servers/*, build/ +application-package-names = tests,vdirsyncer diff --git a/tests/system/cli/__init__.py b/tests/system/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/cli/conftest.py b/tests/system/cli/conftest.py similarity index 100% rename from tests/cli/conftest.py rename to tests/system/cli/conftest.py diff --git a/tests/cli/test_config.py b/tests/system/cli/test_config.py similarity index 100% rename from tests/cli/test_config.py rename to tests/system/cli/test_config.py diff --git a/tests/cli/test_discover.py b/tests/system/cli/test_discover.py similarity index 100% rename from tests/cli/test_discover.py rename to tests/system/cli/test_discover.py diff --git a/tests/cli/test_fetchparams.py b/tests/system/cli/test_fetchparams.py similarity index 100% rename from tests/cli/test_fetchparams.py rename to tests/system/cli/test_fetchparams.py diff --git a/tests/cli/test_repair.py b/tests/system/cli/test_repair.py similarity index 100% rename from tests/cli/test_repair.py rename to tests/system/cli/test_repair.py diff --git a/tests/cli/test_sync.py b/tests/system/cli/test_sync.py similarity index 100% rename from tests/cli/test_sync.py rename to tests/system/cli/test_sync.py diff --git a/tests/cli/test_utils.py b/tests/system/cli/test_utils.py similarity index 100% rename from tests/cli/test_utils.py rename to tests/system/cli/test_utils.py diff --git a/tests/utils/test_main.py b/tests/system/utils/test_main.py similarity index 100% rename from tests/utils/test_main.py rename to tests/system/utils/test_main.py diff --git a/tests/test_metasync.py b/tests/unit/test_metasync.py similarity index 99% rename from tests/test_metasync.py rename to tests/unit/test_metasync.py index bccc779..d36ed14 100644 --- a/tests/test_metasync.py +++ b/tests/unit/test_metasync.py @@ -5,12 +5,12 @@ from hypothesis import example, given import pytest +from tests import blow_up + from vdirsyncer.metasync import MetaSyncConflict, metasync from vdirsyncer.storage.base import normalize_meta_value from vdirsyncer.storage.memory import MemoryStorage -from . import blow_up - def test_irrelevant_status(): a = MemoryStorage() diff --git a/tests/test_repair.py b/tests/unit/test_repair.py similarity index 97% rename from tests/test_repair.py rename to tests/unit/test_repair.py index 6a0d97a..9a1c796 100644 --- a/tests/test_repair.py +++ b/tests/unit/test_repair.py @@ -1,14 +1,13 @@ from hypothesis import given, settings +from tests import uid_strategy from vdirsyncer.repair import repair_storage from vdirsyncer.storage.memory import MemoryStorage from vdirsyncer.utils import href_safe from vdirsyncer.utils.vobject import Item -from . import uid_strategy - @given(uid=uid_strategy) @settings(perform_health_check=False) # Using the random module for UIDs diff --git a/tests/test_sync.py b/tests/unit/test_sync.py similarity index 99% rename from tests/test_sync.py rename to tests/unit/test_sync.py index eab8948..1aab58f 100644 --- a/tests/test_sync.py +++ b/tests/unit/test_sync.py @@ -8,14 +8,14 @@ from hypothesis.stateful import Bundle, RuleBasedStateMachine, rule import pytest +from tests import blow_up, uid_strategy + import vdirsyncer.exceptions as exceptions from vdirsyncer.storage.base import Item from vdirsyncer.storage.memory import MemoryStorage, _random_string from vdirsyncer.sync import BothReadOnly, IdentConflict, PartialSync, \ StorageEmpty, SyncConflict, sync -from . import blow_up, uid_strategy - def empty_storage(x): return list(x.list()) == [] diff --git a/tests/utils/test_vobject.py b/tests/unit/utils/test_vobject.py similarity index 98% rename from tests/utils/test_vobject.py rename to tests/unit/utils/test_vobject.py index 0cc8350..5d27b63 100644 --- a/tests/utils/test_vobject.py +++ b/tests/unit/utils/test_vobject.py @@ -2,10 +2,11 @@ from textwrap import dedent +from tests import BARE_EVENT_TEMPLATE, EVENT_TEMPLATE, VCARD_TEMPLATE, \ + normalize_item + import vdirsyncer.utils.vobject as vobject -from .. import BARE_EVENT_TEMPLATE, EVENT_TEMPLATE, VCARD_TEMPLATE, \ - normalize_item _simple_split = [ VCARD_TEMPLATE.format(r=123, uid=123), diff --git a/tests/utils/__init__.py b/tests/utils/__init__.py deleted file mode 100644 index 40a96af..0000000 --- a/tests/utils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# -*- coding: utf-8 -*-