From 8f8a9f7dd7b8e891c66b3f83faf20382d0e307d2 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 26 May 2022 15:53:23 +0200 Subject: [PATCH] Moved query unittests --- src/cpl_query/tests/__init__.py | 0 src/cpl_query/tests/tester.py | 25 ------------------- unittests/unittests/application.py | 2 ++ .../unittests_query/iterable_test_case.py | 2 +- .../unittests_query}/models.py | 0 .../unittests_query/query_test_case.py | 4 +-- unittests/unittests_query/query_test_suite.py | 17 +++++++++++++ 7 files changed, 22 insertions(+), 28 deletions(-) delete mode 100644 src/cpl_query/tests/__init__.py delete mode 100644 src/cpl_query/tests/tester.py rename src/cpl_query/tests/iterable_test.py => unittests/unittests_query/iterable_test_case.py (91%) rename {src/cpl_query/tests => unittests/unittests_query}/models.py (100%) rename src/cpl_query/tests/query_test.py => unittests/unittests_query/query_test_case.py (99%) create mode 100644 unittests/unittests_query/query_test_suite.py diff --git a/src/cpl_query/tests/__init__.py b/src/cpl_query/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/cpl_query/tests/tester.py b/src/cpl_query/tests/tester.py deleted file mode 100644 index 084071c3..00000000 --- a/src/cpl_query/tests/tester.py +++ /dev/null @@ -1,25 +0,0 @@ -import unittest - -from cpl_query.tests.iterable_test import IterableTest -from cpl_query.tests.query_test import QueryTest - - -class Tester: - - def __init__(self): - self._suite = unittest.TestSuite() - - def create(self): - loader = unittest.TestLoader() - self._suite.addTests(loader.loadTestsFromTestCase(QueryTest)) - self._suite.addTests(loader.loadTestsFromTestCase(IterableTest)) - - def start(self): - runner = unittest.TextTestRunner() - runner.run(self._suite) - - -if __name__ == '__main__': - tester = Tester() - tester.create() - tester.start() diff --git a/unittests/unittests/application.py b/unittests/unittests/application.py index 9af5ad57..9ec49cc6 100644 --- a/unittests/unittests/application.py +++ b/unittests/unittests/application.py @@ -4,6 +4,7 @@ from cpl_core.application import ApplicationABC from cpl_core.configuration import ConfigurationABC from cpl_core.dependency_injection import ServiceProviderABC from unittests_cli.cli_test_suite import CLITestSuite +from unittests_query.query_test_suite import QueryTestSuite class Application(ApplicationABC): @@ -17,3 +18,4 @@ class Application(ApplicationABC): def main(self): runner = unittest.TextTestRunner() runner.run(CLITestSuite()) + runner.run(QueryTestSuite()) diff --git a/src/cpl_query/tests/iterable_test.py b/unittests/unittests_query/iterable_test_case.py similarity index 91% rename from src/cpl_query/tests/iterable_test.py rename to unittests/unittests_query/iterable_test_case.py index a8936a88..2523f500 100644 --- a/src/cpl_query/tests/iterable_test.py +++ b/unittests/unittests_query/iterable_test_case.py @@ -3,7 +3,7 @@ import unittest from cpl_query.extension.list import List -class IterableTest(unittest.TestCase): +class IterableTestCase(unittest.TestCase): def setUp(self) -> None: self._list = List(int) diff --git a/src/cpl_query/tests/models.py b/unittests/unittests_query/models.py similarity index 100% rename from src/cpl_query/tests/models.py rename to unittests/unittests_query/models.py diff --git a/src/cpl_query/tests/query_test.py b/unittests/unittests_query/query_test_case.py similarity index 99% rename from src/cpl_query/tests/query_test.py rename to unittests/unittests_query/query_test_case.py index 9f1e48e2..00d4fed8 100644 --- a/src/cpl_query/tests/query_test.py +++ b/unittests/unittests_query/query_test_case.py @@ -5,10 +5,10 @@ from random import randint from cpl_core.utils import String from cpl_query.exceptions import InvalidTypeException, ArgumentNoneException from cpl_query.extension.list import List -from cpl_query.tests.models import User, Address +from unittests_query.models import User, Address -class QueryTest(unittest.TestCase): +class QueryTestCase(unittest.TestCase): def setUp(self) -> None: self._tests = List(User) diff --git a/unittests/unittests_query/query_test_suite.py b/unittests/unittests_query/query_test_suite.py new file mode 100644 index 00000000..35c3fe03 --- /dev/null +++ b/unittests/unittests_query/query_test_suite.py @@ -0,0 +1,17 @@ +import unittest + +from unittests_query.iterable_test_case import IterableTestCase +from unittests_query.query_test_case import QueryTestCase + + +class QueryTestSuite(unittest.TestSuite): + + def __init__(self): + unittest.TestSuite.__init__(self) + + loader = unittest.TestLoader() + self.addTests(loader.loadTestsFromTestCase(QueryTestCase)) + self.addTests(loader.loadTestsFromTestCase(IterableTestCase)) + + def run(self, *args): + super().run(*args)