From e38988be1bed5dc40307d0041728b0571078a5a7 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 7 Apr 2021 22:11:22 +0200 Subject: [PATCH] Changed project files of general test project --- cpl.json | 57 ------------------- src/cpl_cli/live_server/live_server_thread.py | 14 ++--- src/tests/custom/console/__init__.py | 0 src/tests/custom/general/__init__.py | 0 src/tests/custom/general/cpl-workspace.json | 8 +++ .../{ => general/src/general}/__init__.py | 0 .../general/{ => src/general}/application.py | 2 +- .../general/{ => src/general}/db/__init__.py | 0 .../{cpl.json => src/general/general.json} | 0 .../custom/general/{ => src/general}/main.py | 4 +- .../general/{ => src/general}/startup.py | 3 +- .../general/{ => src/general}/test_service.py | 0 12 files changed, 19 insertions(+), 69 deletions(-) delete mode 100644 cpl.json delete mode 100644 src/tests/custom/console/__init__.py delete mode 100644 src/tests/custom/general/__init__.py create mode 100644 src/tests/custom/general/cpl-workspace.json rename src/tests/custom/{ => general/src/general}/__init__.py (100%) rename src/tests/custom/general/{ => src/general}/application.py (97%) rename src/tests/custom/general/{ => src/general}/db/__init__.py (100%) rename src/tests/custom/general/{cpl.json => src/general/general.json} (100%) rename src/tests/custom/general/{ => src/general}/main.py (69%) rename src/tests/custom/general/{ => src/general}/startup.py (93%) rename src/tests/custom/general/{ => src/general}/test_service.py (100%) diff --git a/cpl.json b/cpl.json deleted file mode 100644 index a604419b..00000000 --- a/cpl.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "ProjectSettings": { - "Name": "sh_cpl", - "Version": { - "Major": "2021", - "Minor": "4", - "Micro": "post1" - }, - "Author": "Sven Heidemann", - "AuthorEmail": "sven.heidemann@sh-edraft.de", - "Description": "sh-edraft Common Python library", - "LongDescription": "sh-edraft Common Python library", - "URL": "https://www.sh-edraft.de", - "CopyrightDate": "2020 - 2021", - "CopyrightName": "sh-edraft.de", - "LicenseName": "MIT", - "LicenseDescription": "MIT, see LICENSE for more details.", - "Dependencies": [ - "colorama==0.4.4", - "mysql-connector==2.2.9", - "psutil==5.8.0", - "packaging==20.9", - "pyfiglet==0.8.post1", - "pynput==1.7.3", - "SQLAlchemy==1.4.3", - "setuptools==54.2.0", - "tabulate==0.8.9", - "termcolor==1.1.0", - "watchdog==2.0.2", - "wheel==0.36.2" - ], - "PythonVersion": ">=3.8", - "PythonPath": {}, - "Classifiers": [] - }, - "BuildSettings": { - "ProjectType": "library", - "SourcePath": "src", - "OutputPath": "dist", - "Main": "cpl_cli.main", - "EntryPoint": "cpl", - "IncludePackageData": true, - "Included": [ - "*/templates" - ], - "Excluded": [ - "*/__pycache__", - "*/logs", - "*/tests" - ], - "PackageData": { - "cpl_cli": [ - "*.json" - ] - } - } -} \ No newline at end of file diff --git a/src/cpl_cli/live_server/live_server_thread.py b/src/cpl_cli/live_server/live_server_thread.py index 1519e3e2..e394c8b8 100644 --- a/src/cpl_cli/live_server/live_server_thread.py +++ b/src/cpl_cli/live_server/live_server_thread.py @@ -50,13 +50,6 @@ class LiveServerThread(threading.Thread): Console.error('Entry point main.py not found') return - Console.set_foreground_color(ForegroundColorEnum.green) - Console.write_line('Read successfully') - Console.set_foreground_color(ForegroundColorEnum.cyan) - now = datetime.now() - Console.write_line(f'Started at {now.strftime("%Y-%m-%d %H:%M:%S")}\n\n') - Console.set_foreground_color(ForegroundColorEnum.default) - env_vars = os.environ if sys.platform == 'win32': env_vars['PYTHONPATH'] = f'{os.path.dirname(src_path)};' \ @@ -65,5 +58,12 @@ class LiveServerThread(threading.Thread): env_vars['PYTHONPATH'] = f'{os.path.dirname(src_path)}:' \ f'{os.path.join(os.path.dirname(src_path), self._build_settings.source_path)}' + Console.set_foreground_color(ForegroundColorEnum.green) + Console.write_line('Read successfully') + Console.set_foreground_color(ForegroundColorEnum.cyan) + now = datetime.now() + Console.write_line(f'Started at {now.strftime("%Y-%m-%d %H:%M:%S")}\n\n') + Console.set_foreground_color(ForegroundColorEnum.default) + self._command = [sys.executable, self._main, ''.join(self._args)] subprocess.run(self._command, env=env_vars) diff --git a/src/tests/custom/console/__init__.py b/src/tests/custom/console/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/tests/custom/general/__init__.py b/src/tests/custom/general/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/src/tests/custom/general/cpl-workspace.json b/src/tests/custom/general/cpl-workspace.json new file mode 100644 index 00000000..3b5ae16f --- /dev/null +++ b/src/tests/custom/general/cpl-workspace.json @@ -0,0 +1,8 @@ +{ + "Workspace": { + "DefaultProject": "general", + "Projects": { + "general": "src/general/general.json" + } + } +} \ No newline at end of file diff --git a/src/tests/custom/__init__.py b/src/tests/custom/general/src/general/__init__.py similarity index 100% rename from src/tests/custom/__init__.py rename to src/tests/custom/general/src/general/__init__.py diff --git a/src/tests/custom/general/application.py b/src/tests/custom/general/src/general/application.py similarity index 97% rename from src/tests/custom/general/application.py rename to src/tests/custom/general/src/general/application.py index f7af31b0..96bcb086 100644 --- a/src/tests/custom/general/application.py +++ b/src/tests/custom/general/src/general/application.py @@ -8,7 +8,7 @@ from cpl.dependency_injection.service_provider_abc import ServiceProviderABC from cpl.logging.logger_abc import LoggerABC from cpl.mailing.email import EMail from cpl.mailing.email_client_abc import EMailClientABC -from tests.custom.general.test_service import TestService +from test_service import TestService class Application(ApplicationABC): diff --git a/src/tests/custom/general/db/__init__.py b/src/tests/custom/general/src/general/db/__init__.py similarity index 100% rename from src/tests/custom/general/db/__init__.py rename to src/tests/custom/general/src/general/db/__init__.py diff --git a/src/tests/custom/general/cpl.json b/src/tests/custom/general/src/general/general.json similarity index 100% rename from src/tests/custom/general/cpl.json rename to src/tests/custom/general/src/general/general.json diff --git a/src/tests/custom/general/main.py b/src/tests/custom/general/src/general/main.py similarity index 69% rename from src/tests/custom/general/main.py rename to src/tests/custom/general/src/general/main.py index a9fd514f..a2e8cbd0 100644 --- a/src/tests/custom/general/main.py +++ b/src/tests/custom/general/src/general/main.py @@ -1,6 +1,6 @@ from cpl.application.application_builder import ApplicationBuilder -from tests.custom.general.application import Application -from tests.custom.general.startup import Startup +from application import Application +from startup import Startup def main(): diff --git a/src/tests/custom/general/startup.py b/src/tests/custom/general/src/general/startup.py similarity index 93% rename from src/tests/custom/general/startup.py rename to src/tests/custom/general/src/general/startup.py index d0370bff..102ae67b 100644 --- a/src/tests/custom/general/startup.py +++ b/src/tests/custom/general/src/general/startup.py @@ -6,7 +6,7 @@ from cpl.logging.logger_service import Logger from cpl.logging.logger_abc import LoggerABC from cpl.mailing.email_client_service import EMailClient from cpl.mailing.email_client_abc import EMailClientABC -from tests.custom.general.test_service import TestService +from test_service import TestService class Startup(StartupABC): @@ -20,7 +20,6 @@ class Startup(StartupABC): def configure_configuration(self) -> ConfigurationABC: self._configuration.add_environment_variables('PYTHON_') self._configuration.add_environment_variables('CPL_') - self._configuration.add_console_arguments() self._configuration.add_json_file(f'appsettings.json') self._configuration.add_json_file(f'appsettings.{self._configuration.environment.environment_name}.json') self._configuration.add_json_file(f'appsettings.{self._configuration.environment.host_name}.json', optional=True) diff --git a/src/tests/custom/general/test_service.py b/src/tests/custom/general/src/general/test_service.py similarity index 100% rename from src/tests/custom/general/test_service.py rename to src/tests/custom/general/src/general/test_service.py