Improved unittests

This commit is contained in:
Sven Heidemann 2022-05-26 23:01:50 +02:00
parent 3a1630b687
commit 56380763a9
6 changed files with 36 additions and 16 deletions

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "17.dev6" "Micro": "17.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,7 +16,7 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.17.dev6" "cpl-core>=2022.6.17.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -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))) 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.exists(project_path))
self.assertTrue(os.path.join(project_path, f'{name}.json')) 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'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': 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): 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))) os.chdir(os.path.abspath(os.path.join(os.getcwd(), workspace_name)))
@ -41,6 +52,15 @@ class NewTestCase(unittest.TestCase):
def test_console(self): def test_console(self):
self._test_project('console', 'test-console', '--ab', '--s', '--sp') 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): def test_sub_console(self):
self._test_sub_project('console', 'test-sub-console', 'test-console', '--ab', '--s', '--sp') 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') self._test_sub_project('library', 'test-sub-library', 'test-console', '--ab', '--s', '--sp')
def test_unittest(self): 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): def test_sub_unittest(self):
self._test_sub_project('unittest', 'test-unittest', 'test-console', '--ab', '--s', '--sp') self._test_sub_project('unittest', 'test-unittest', 'test-console', '--ab', '--s', '--sp')

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "17.dev6" "Micro": "17.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,8 +16,8 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.17.dev6", "cpl-core>=2022.6.17.dev7",
"cpl-cli>=2022.6.17.dev6" "cpl-cli>=2022.6.17.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "17.dev6" "Micro": "17.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,7 +16,7 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.17.dev6" "cpl-core>=2022.6.17.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "17.dev6" "Micro": "17.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,8 +16,8 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.17.dev6", "cpl-core>=2022.6.17.dev7",
"cpl-query>=2022.6.17.dev6" "cpl-query>=2022.6.17.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "17.dev6" "Micro": "17.dev7"
}, },
"Author": "", "Author": "",
"AuthorEmail": "", "AuthorEmail": "",
@ -16,7 +16,7 @@
"LicenseName": "", "LicenseName": "",
"LicenseDescription": "", "LicenseDescription": "",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.17.dev6" "cpl-core>=2022.6.17.dev7"
], ],
"PythonVersion": ">=3.10.4", "PythonVersion": ">=3.10.4",
"PythonPath": { "PythonPath": {