From 1b6099d28436630193f0fe6bfe3635e1f28c9e09 Mon Sep 17 00:00:00 2001 From: Bert Palm <bert.palm@ufz.de> Date: Fri, 12 Mar 2021 15:56:13 +0100 Subject: [PATCH] changed structure of tests --- test/flagger/__init__.py | 0 {testsfuzzy => tests}/__init__.py | 0 {test => tests}/common.py | 0 {test => tests}/core/__init__.py | 0 {test => tests}/core/test_core.py | 4 ++-- {test => tests}/core/test_creation.py | 0 {test => tests}/core/test_reader.py | 2 +- {test => tests}/fixtures.py | 0 {test => tests/flagger}/__init__.py | 0 {test => tests}/flagger/test_flagger.py | 2 +- {test => tests}/flagger/test_flags.py | 2 +- {test => tests}/flagger/test_history.py | 0 {test => tests}/funcs/__init__.py | 0 {test => tests}/funcs/test_constants_detection.py | 2 +- {test => tests}/funcs/test_functions.py | 9 +++------ {test => tests}/funcs/test_generic_api_functions.py | 4 +--- {test => tests}/funcs/test_generic_config_functions.py | 2 +- {test => tests}/funcs/test_harm_funcs.py | 2 +- {test => tests}/funcs/test_modelling.py | 7 ++----- {test => tests}/funcs/test_pattern_rec.py | 4 ++-- {test => tests}/funcs/test_proc_functions.py | 7 ++----- {test => tests}/funcs/test_spikes_detection.py | 7 ++----- tests/fuzzy/__init__.py | 1 + {testsfuzzy => tests/fuzzy}/init.py | 0 {testsfuzzy => tests/fuzzy}/test_functions.py | 2 +- {testsfuzzy => tests/fuzzy}/test_masking.py | 9 ++------- tests/lib/__init__.py | 1 + {test => tests}/lib/test_rolling.py | 0 28 files changed, 25 insertions(+), 42 deletions(-) delete mode 100644 test/flagger/__init__.py rename {testsfuzzy => tests}/__init__.py (100%) rename {test => tests}/common.py (100%) rename {test => tests}/core/__init__.py (100%) rename {test => tests}/core/test_core.py (97%) rename {test => tests}/core/test_creation.py (100%) rename {test => tests}/core/test_reader.py (98%) rename {test => tests}/fixtures.py (100%) rename {test => tests/flagger}/__init__.py (100%) rename {test => tests}/flagger/test_flagger.py (99%) rename {test => tests}/flagger/test_flags.py (99%) rename {test => tests}/flagger/test_history.py (100%) rename {test => tests}/funcs/__init__.py (100%) rename {test => tests}/funcs/test_constants_detection.py (96%) rename {test => tests}/funcs/test_functions.py (98%) rename {test => tests}/funcs/test_generic_api_functions.py (95%) rename {test => tests}/funcs/test_generic_config_functions.py (99%) rename {test => tests}/funcs/test_harm_funcs.py (99%) rename {test => tests}/funcs/test_modelling.py (96%) rename {test => tests}/funcs/test_pattern_rec.py (94%) rename {test => tests}/funcs/test_proc_functions.py (97%) rename {test => tests}/funcs/test_spikes_detection.py (96%) create mode 100644 tests/fuzzy/__init__.py rename {testsfuzzy => tests/fuzzy}/init.py (100%) rename {testsfuzzy => tests/fuzzy}/test_functions.py (97%) rename {testsfuzzy => tests/fuzzy}/test_masking.py (96%) create mode 100644 tests/lib/__init__.py rename {test => tests}/lib/test_rolling.py (100%) diff --git a/test/flagger/__init__.py b/test/flagger/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/testsfuzzy/__init__.py b/tests/__init__.py similarity index 100% rename from testsfuzzy/__init__.py rename to tests/__init__.py diff --git a/test/common.py b/tests/common.py similarity index 100% rename from test/common.py rename to tests/common.py diff --git a/test/core/__init__.py b/tests/core/__init__.py similarity index 100% rename from test/core/__init__.py rename to tests/core/__init__.py diff --git a/test/core/test_core.py b/tests/core/test_core.py similarity index 97% rename from test/core/test_core.py rename to tests/core/test_core.py index 51b99f5c4..cddc2fd59 100644 --- a/test/core/test_core.py +++ b/tests/core/test_core.py @@ -7,12 +7,12 @@ import numpy as np import pandas as pd from saqc.common import * -from saqc.flagger import Flagger, initFlagsLike +from saqc.flagger import initFlagsLike from saqc.funcs import flagRange from saqc.lib import plotting as splot from saqc import SaQC, register -from test.common import initData, flagAll +from tests.common import initData, flagAll # no logging output needed here # -> can this be configured on the test runner level? diff --git a/test/core/test_creation.py b/tests/core/test_creation.py similarity index 100% rename from test/core/test_creation.py rename to tests/core/test_creation.py diff --git a/test/core/test_reader.py b/tests/core/test_reader.py similarity index 98% rename from test/core/test_reader.py rename to tests/core/test_reader.py index 9ab7d2a51..e2d80042b 100644 --- a/test/core/test_reader.py +++ b/tests/core/test_reader.py @@ -11,7 +11,7 @@ from saqc.core.config import Fields as F from saqc.core.core import SaQC from saqc.core.register import FUNC_MAP, register -from test.common import initData, writeIO +from tests.common import initData, writeIO @pytest.fixture diff --git a/test/fixtures.py b/tests/fixtures.py similarity index 100% rename from test/fixtures.py rename to tests/fixtures.py diff --git a/test/__init__.py b/tests/flagger/__init__.py similarity index 100% rename from test/__init__.py rename to tests/flagger/__init__.py diff --git a/test/flagger/test_flagger.py b/tests/flagger/test_flagger.py similarity index 99% rename from test/flagger/test_flagger.py rename to tests/flagger/test_flagger.py index a304409fb..1af9f4710 100644 --- a/test/flagger/test_flagger.py +++ b/tests/flagger/test_flagger.py @@ -7,7 +7,7 @@ from pandas.api.types import is_bool_dtype import dios -from test.common import TESTFLAGGER, initData +from tests.common import TESTFLAGGER, initData pytestmark = pytest.mark.skip('old flagger tests - rewrite needed') diff --git a/test/flagger/test_flags.py b/tests/flagger/test_flags.py similarity index 99% rename from test/flagger/test_flags.py rename to tests/flagger/test_flags.py index c04177101..652022048 100644 --- a/test/flagger/test_flags.py +++ b/tests/flagger/test_flags.py @@ -7,7 +7,7 @@ import pandas as pd from saqc.common import * from saqc.flagger.flags import Flags -from test.flagger.test_history import ( +from tests.flagger.test_history import ( History, is_equal as hist_equal, ) diff --git a/test/flagger/test_history.py b/tests/flagger/test_history.py similarity index 100% rename from test/flagger/test_history.py rename to tests/flagger/test_history.py diff --git a/test/funcs/__init__.py b/tests/funcs/__init__.py similarity index 100% rename from test/funcs/__init__.py rename to tests/funcs/__init__.py diff --git a/test/funcs/test_constants_detection.py b/tests/funcs/test_constants_detection.py similarity index 96% rename from test/funcs/test_constants_detection.py rename to tests/funcs/test_constants_detection.py index 30a16db10..1ae7be198 100644 --- a/test/funcs/test_constants_detection.py +++ b/tests/funcs/test_constants_detection.py @@ -8,7 +8,7 @@ from saqc.common import * from saqc.funcs.constants import flagConstants, flagByVariance from saqc.flagger import initFlagsLike -from test.common import initData +from tests.common import initData @pytest.fixture diff --git a/test/funcs/test_functions.py b/tests/funcs/test_functions.py similarity index 98% rename from test/funcs/test_functions.py rename to tests/funcs/test_functions.py index a205e517d..bbaa20ad5 100644 --- a/test/funcs/test_functions.py +++ b/tests/funcs/test_functions.py @@ -1,13 +1,10 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -import pytest -import pandas as pd -import numpy as np import dios from saqc.common import * -from saqc.flagger import Flagger, initFlagsLike +from saqc.flagger import initFlagsLike from saqc.funcs.drift import flagDriftFromNorm, flagDriftFromReference, flagDriftFromScaledNorm from saqc.funcs.outliers import flagCrossStatistic, flagRange from saqc.funcs.flagtools import flagManual, forceFlags, clearFlags @@ -15,8 +12,8 @@ from saqc.funcs.tools import drop, copy, mask from saqc.funcs.resampling import reindexFlags from saqc.funcs.breaks import flagIsolated -from test.fixtures import * -from test.common import initData +from tests.fixtures import * +from tests.common import initData @pytest.fixture diff --git a/test/funcs/test_generic_api_functions.py b/tests/funcs/test_generic_api_functions.py similarity index 95% rename from test/funcs/test_generic_api_functions.py rename to tests/funcs/test_generic_api_functions.py index 76c9f0d53..d581c4344 100644 --- a/test/funcs/test_generic_api_functions.py +++ b/tests/funcs/test_generic_api_functions.py @@ -1,9 +1,7 @@ #! /usr/bin/env python # -*- coding: utf-8 -*- -import ast import pytest -import numpy as np import pandas as pd from saqc.common import * @@ -11,7 +9,7 @@ from saqc.core.register import register from saqc.funcs.tools import mask from saqc import SaQC -from test.common import initData, flagAll +from tests.common import initData, flagAll register(masking='field')(flagAll) diff --git a/test/funcs/test_generic_config_functions.py b/tests/funcs/test_generic_config_functions.py similarity index 99% rename from test/funcs/test_generic_config_functions.py rename to tests/funcs/test_generic_config_functions.py index 81e91d643..6e84e6a99 100644 --- a/test/funcs/test_generic_config_functions.py +++ b/tests/funcs/test_generic_config_functions.py @@ -15,7 +15,7 @@ from saqc.core.register import register from saqc.funcs.generic import _execGeneric from saqc import SaQC -from test.common import TESTNODATA, initData, writeIO +from tests.common import TESTNODATA, initData, writeIO @pytest.fixture diff --git a/test/funcs/test_harm_funcs.py b/tests/funcs/test_harm_funcs.py similarity index 99% rename from test/funcs/test_harm_funcs.py rename to tests/funcs/test_harm_funcs.py index 187a4b7c4..4f12a41d2 100644 --- a/test/funcs/test_harm_funcs.py +++ b/tests/funcs/test_harm_funcs.py @@ -8,7 +8,7 @@ import numpy as np import pandas as pd import dios -from test.common import TESTFLAGGER +from tests.common import TESTFLAGGER from saqc.funcs.resampling import ( linear, diff --git a/test/funcs/test_modelling.py b/tests/funcs/test_modelling.py similarity index 96% rename from test/funcs/test_modelling.py rename to tests/funcs/test_modelling.py index 748a06fa3..6d99d5786 100644 --- a/test/funcs/test_modelling.py +++ b/tests/funcs/test_modelling.py @@ -4,16 +4,13 @@ # see test/functs/fixtures.py for global fixtures "course_..." -import pytest -import numpy as np -import pandas as pd import dios from saqc.funcs.tools import mask from saqc.funcs.residues import calculatePolynomialResidues, calculateRollingResidues -from test.fixtures import * -from test.common import TESTFLAGGER +from tests.fixtures import * +from tests.common import TESTFLAGGER TF = TESTFLAGGER[:1] diff --git a/test/funcs/test_pattern_rec.py b/tests/funcs/test_pattern_rec.py similarity index 94% rename from test/funcs/test_pattern_rec.py rename to tests/funcs/test_pattern_rec.py index 6f437edc2..3ca69d707 100644 --- a/test/funcs/test_pattern_rec.py +++ b/tests/funcs/test_pattern_rec.py @@ -6,9 +6,9 @@ import pandas as pd import dios from saqc.common import * -from saqc.flagger import Flagger, initFlagsLike +from saqc.flagger import initFlagsLike from saqc.funcs.pattern import * -from test.common import initData +from tests.common import initData @pytest.fixture diff --git a/test/funcs/test_proc_functions.py b/tests/funcs/test_proc_functions.py similarity index 97% rename from test/funcs/test_proc_functions.py rename to tests/funcs/test_proc_functions.py index 7f07e1d2e..31337badc 100644 --- a/test/funcs/test_proc_functions.py +++ b/tests/funcs/test_proc_functions.py @@ -4,9 +4,6 @@ # see test/functs/fixtures.py for global fixtures "course_..." -import pytest -import numpy as np -import pandas as pd import dios from saqc.common import * @@ -16,8 +13,8 @@ from saqc.funcs.interpolation import interpolateByRolling, interpolateInvalid, i from saqc.funcs.resampling import resample from saqc.lib.ts_operators import linearInterpolation, polynomialInterpolation -from test.fixtures import * -from test.common import TESTFLAGGER +from tests.fixtures import * +from tests.common import TESTFLAGGER @pytest.mark.parametrize("flagger", TESTFLAGGER) diff --git a/test/funcs/test_spikes_detection.py b/tests/funcs/test_spikes_detection.py similarity index 96% rename from test/funcs/test_spikes_detection.py rename to tests/funcs/test_spikes_detection.py index 13526b62d..578dd9c44 100644 --- a/test/funcs/test_spikes_detection.py +++ b/tests/funcs/test_spikes_detection.py @@ -2,11 +2,8 @@ # -*- coding: utf-8 -*- # see test/functs/fixtures.py for global fixtures "course_..." -import pytest -import numpy as np -import pandas as pd import dios -from test.fixtures import * +from tests.fixtures import * from saqc.funcs.outliers import ( flagMAD, @@ -16,7 +13,7 @@ from saqc.funcs.outliers import ( flagByGrubbs, ) from saqc.common import * -from saqc.flagger import Flagger, initFlagsLike +from saqc.flagger import initFlagsLike @pytest.fixture(scope="module") diff --git a/tests/fuzzy/__init__.py b/tests/fuzzy/__init__.py new file mode 100644 index 000000000..4265cc3e6 --- /dev/null +++ b/tests/fuzzy/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python diff --git a/testsfuzzy/init.py b/tests/fuzzy/init.py similarity index 100% rename from testsfuzzy/init.py rename to tests/fuzzy/init.py diff --git a/testsfuzzy/test_functions.py b/tests/fuzzy/test_functions.py similarity index 97% rename from testsfuzzy/test_functions.py rename to tests/fuzzy/test_functions.py index fc3caa00e..09d1f8484 100644 --- a/testsfuzzy/test_functions.py +++ b/tests/fuzzy/test_functions.py @@ -6,7 +6,7 @@ from hypothesis import given, settings from hypothesis.strategies import data, from_type from saqc.core.register import FUNC_MAP -from testsfuzzy.init import MAX_EXAMPLES, functionKwargs +from tests.fuzzy.init import MAX_EXAMPLES, functionKwargs @settings(max_examples=MAX_EXAMPLES, deadline=None) diff --git a/testsfuzzy/test_masking.py b/tests/fuzzy/test_masking.py similarity index 96% rename from testsfuzzy/test_masking.py rename to tests/fuzzy/test_masking.py index b1eb5861e..9d45520eb 100644 --- a/testsfuzzy/test_masking.py +++ b/tests/fuzzy/test_masking.py @@ -6,17 +6,12 @@ import logging import pandas as pd from hypothesis import given, settings -from hypothesis.strategies import ( - sampled_from, - composite, - sampled_from, -) from saqc.common import * -from saqc.flagger import Flagger, initFlagsLike +from saqc.flagger import Flagger from saqc.core.register import _maskData, _unmaskData -from testsfuzzy.init import dataFieldFlagger, MAX_EXAMPLES +from tests.fuzzy.init import dataFieldFlagger, MAX_EXAMPLES logging.disable(logging.CRITICAL) diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py new file mode 100644 index 000000000..4265cc3e6 --- /dev/null +++ b/tests/lib/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python diff --git a/test/lib/test_rolling.py b/tests/lib/test_rolling.py similarity index 100% rename from test/lib/test_rolling.py rename to tests/lib/test_rolling.py -- GitLab