From 56380763a9c5aed7e96045cfa8ffd162daee4b1d Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 26 May 2022 23:01:50 +0200 Subject: [PATCH] Improved unittests --- unittests/unittests/unittests.json | 4 +-- unittests/unittests_cli/new_test_case.py | 28 ++++++++++++++++--- unittests/unittests_cli/unittests_cli.json | 6 ++-- unittests/unittests_core/unittests_core.json | 4 +-- .../unittests_query/unittests_query.json | 6 ++-- .../unittests_shared/unittests_shared.json | 4 +-- 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/unittests/unittests/unittests.json b/unittests/unittests/unittests.json index be802510..c9be15f0 100644 --- a/unittests/unittests/unittests.json +++ b/unittests/unittests/unittests.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "17.dev6" + "Micro": "17.dev7" }, "Author": "", "AuthorEmail": "", @@ -16,7 +16,7 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.6.17.dev6" + "cpl-core>=2022.6.17.dev7" ], "PythonVersion": ">=3.10.4", "PythonPath": { diff --git a/unittests/unittests_cli/new_test_case.py b/unittests/unittests_cli/new_test_case.py index 1caa725e..fa2f8070 100644 --- a/unittests/unittests_cli/new_test_case.py +++ b/unittests/unittests_cli/new_test_case.py @@ -21,11 +21,22 @@ class NewTestCase(unittest.TestCase): project_path = os.path.abspath(os.path.join(PLAYGROUND_PATH, name, 'src', String.convert_to_snake_case(name))) self.assertTrue(os.path.exists(project_path)) self.assertTrue(os.path.join(project_path, f'{name}.json')) - self.assertTrue(os.path.join(project_path, f'application.py')) self.assertTrue(os.path.join(project_path, f'main.py')) - self.assertTrue(os.path.join(project_path, f'startup.py')) + + if '--ab' in args: + self.assertTrue(os.path.isfile(os.path.join(project_path, f'application.py'))) + else: + self.assertFalse(os.path.isfile(os.path.join(project_path, f'application.py'))) + + if '--sp' in args: + self.assertTrue(os.path.isfile(os.path.join(project_path, f'startup.py'))) + else: + self.assertFalse(os.path.isfile(os.path.join(project_path, f'startup.py'))) + if project_type == 'unittest': - self.assertTrue(os.path.join(project_path, f'test_case_test_case.py')) + self.assertTrue(os.path.isfile(os.path.join(project_path, f'test_case.py'))) + else: + self.assertFalse(os.path.isfile(os.path.join(project_path, f'test_case.py'))) def _test_sub_project(self, project_type: str, name: str, workspace_name: str, *args): os.chdir(os.path.abspath(os.path.join(os.getcwd(), workspace_name))) @@ -41,6 +52,15 @@ class NewTestCase(unittest.TestCase): def test_console(self): self._test_project('console', 'test-console', '--ab', '--s', '--sp') + def test_console_without_sp(self): + self._test_project('console', 'test-console-without-sp', '--ab', '--s') + + def test_console_without_s(self): + self._test_project('console', 'test-console-without-s', '--ab') + + def test_console_without_ab(self): + self._test_project('console', 'test-console-without-ab', '--sp') + def test_sub_console(self): self._test_sub_project('console', 'test-sub-console', 'test-console', '--ab', '--s', '--sp') @@ -51,7 +71,7 @@ class NewTestCase(unittest.TestCase): self._test_sub_project('library', 'test-sub-library', 'test-console', '--ab', '--s', '--sp') def test_unittest(self): - self._test_project('unittest', 'test-unittest', '--ab', '--s', '--sp') + self._test_project('unittest', 'test-unittest', '--ab') def test_sub_unittest(self): self._test_sub_project('unittest', 'test-unittest', 'test-console', '--ab', '--s', '--sp') diff --git a/unittests/unittests_cli/unittests_cli.json b/unittests/unittests_cli/unittests_cli.json index bd09248a..c8681484 100644 --- a/unittests/unittests_cli/unittests_cli.json +++ b/unittests/unittests_cli/unittests_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "17.dev6" + "Micro": "17.dev7" }, "Author": "", "AuthorEmail": "", @@ -16,8 +16,8 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.6.17.dev6", - "cpl-cli>=2022.6.17.dev6" + "cpl-core>=2022.6.17.dev7", + "cpl-cli>=2022.6.17.dev7" ], "PythonVersion": ">=3.10.4", "PythonPath": { diff --git a/unittests/unittests_core/unittests_core.json b/unittests/unittests_core/unittests_core.json index fdf7b69a..f8dedcd3 100644 --- a/unittests/unittests_core/unittests_core.json +++ b/unittests/unittests_core/unittests_core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "17.dev6" + "Micro": "17.dev7" }, "Author": "", "AuthorEmail": "", @@ -16,7 +16,7 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.6.17.dev6" + "cpl-core>=2022.6.17.dev7" ], "PythonVersion": ">=3.10.4", "PythonPath": { diff --git a/unittests/unittests_query/unittests_query.json b/unittests/unittests_query/unittests_query.json index 326c72d1..c4f1ed2e 100644 --- a/unittests/unittests_query/unittests_query.json +++ b/unittests/unittests_query/unittests_query.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "17.dev6" + "Micro": "17.dev7" }, "Author": "", "AuthorEmail": "", @@ -16,8 +16,8 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.6.17.dev6", - "cpl-query>=2022.6.17.dev6" + "cpl-core>=2022.6.17.dev7", + "cpl-query>=2022.6.17.dev7" ], "PythonVersion": ">=3.10.4", "PythonPath": { diff --git a/unittests/unittests_shared/unittests_shared.json b/unittests/unittests_shared/unittests_shared.json index cab18497..9f28e0b7 100644 --- a/unittests/unittests_shared/unittests_shared.json +++ b/unittests/unittests_shared/unittests_shared.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "17.dev6" + "Micro": "17.dev7" }, "Author": "", "AuthorEmail": "", @@ -16,7 +16,7 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.6.17.dev6" + "cpl-core>=2022.6.17.dev7" ], "PythonVersion": ">=3.10.4", "PythonPath": {