From 4402bcce735ce71da5a689a6afc64ac902d8d8fd Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sat, 16 Jul 2022 12:22:10 +0200 Subject: [PATCH] Added test project --- src/tests/custom/discord/LICENSE | 0 src/tests/custom/discord/README.md | 0 src/tests/custom/discord/cpl-workspace.json | 9 ++++ .../custom/discord/src/discord/__init__.py | 1 + .../custom/discord/src/discord/application.py | 16 +++++++ .../custom/discord/src/discord/discord.json | 46 +++++++++++++++++++ src/tests/custom/discord/src/discord/main.py | 17 +++++++ .../custom/discord/src/discord/startup.py | 16 +++++++ .../custom/discord/src/tests/__init__.py | 1 + 9 files changed, 106 insertions(+) create mode 100644 src/tests/custom/discord/LICENSE create mode 100644 src/tests/custom/discord/README.md create mode 100644 src/tests/custom/discord/cpl-workspace.json create mode 100644 src/tests/custom/discord/src/discord/__init__.py create mode 100644 src/tests/custom/discord/src/discord/application.py create mode 100644 src/tests/custom/discord/src/discord/discord.json create mode 100644 src/tests/custom/discord/src/discord/main.py create mode 100644 src/tests/custom/discord/src/discord/startup.py create mode 100644 src/tests/custom/discord/src/tests/__init__.py diff --git a/src/tests/custom/discord/LICENSE b/src/tests/custom/discord/LICENSE new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/discord/README.md b/src/tests/custom/discord/README.md new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/custom/discord/cpl-workspace.json b/src/tests/custom/discord/cpl-workspace.json new file mode 100644 index 00000000..8db07df1 --- /dev/null +++ b/src/tests/custom/discord/cpl-workspace.json @@ -0,0 +1,9 @@ +{ + "WorkspaceSettings": { + "DefaultProject": "discord", + "Projects": { + "discord": "src/discord/discord.json" + }, + "Scripts": {} + } +} \ No newline at end of file diff --git a/src/tests/custom/discord/src/discord/__init__.py b/src/tests/custom/discord/src/discord/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/discord/src/discord/__init__.py @@ -0,0 +1 @@ +# imports: diff --git a/src/tests/custom/discord/src/discord/application.py b/src/tests/custom/discord/src/discord/application.py new file mode 100644 index 00000000..b2df0250 --- /dev/null +++ b/src/tests/custom/discord/src/discord/application.py @@ -0,0 +1,16 @@ +from cpl_core.application import ApplicationABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console +from cpl_core.dependency_injection import ServiceProviderABC + + +class Application(ApplicationABC): + + def __init__(self, config: ConfigurationABC, services: ServiceProviderABC): + ApplicationABC.__init__(self, config, services) + + async def configure(self): + pass + + async def main(self): + Console.write_line('Hello World') diff --git a/src/tests/custom/discord/src/discord/discord.json b/src/tests/custom/discord/src/discord/discord.json new file mode 100644 index 00000000..a3fbc95b --- /dev/null +++ b/src/tests/custom/discord/src/discord/discord.json @@ -0,0 +1,46 @@ +{ + "ProjectSettings": { + "Name": "discord", + "Version": { + "Major": "0", + "Minor": "0", + "Micro": "0" + }, + "Author": "", + "AuthorEmail": "", + "Description": "", + "LongDescription": "", + "URL": "", + "CopyrightDate": "", + "CopyrightName": "", + "LicenseName": "", + "LicenseDescription": "", + "Dependencies": [ + "cpl-core>=2022.7.0" + ], + "DevDependencies": [ + "cpl-cli>=2022.7.0" + ], + "PythonVersion": ">=3.10.4", + "PythonPath": { + "linux": "" + }, + "Classifiers": [] + }, + "BuildSettings": { + "ProjectType": "console", + "SourcePath": "", + "OutputPath": "../../dist", + "Main": "discord.main", + "EntryPoint": "discord", + "IncludePackageData": false, + "Included": [], + "Excluded": [ + "*/__pycache__", + "*/logs", + "*/tests" + ], + "PackageData": {}, + "ProjectReferences": [] + } +} \ No newline at end of file diff --git a/src/tests/custom/discord/src/discord/main.py b/src/tests/custom/discord/src/discord/main.py new file mode 100644 index 00000000..028d4e62 --- /dev/null +++ b/src/tests/custom/discord/src/discord/main.py @@ -0,0 +1,17 @@ +import asyncio + +from cpl_core.application import ApplicationBuilder + +from discord.application import Application +from discord.startup import Startup + + +async def main(): + app_builder = ApplicationBuilder(Application) + app_builder.use_startup(Startup) + app: Application = await app_builder.build_async() + await app.run_async() + + +if __name__ == '__main__': + asyncio.run(main()) diff --git a/src/tests/custom/discord/src/discord/startup.py b/src/tests/custom/discord/src/discord/startup.py new file mode 100644 index 00000000..359c03d2 --- /dev/null +++ b/src/tests/custom/discord/src/discord/startup.py @@ -0,0 +1,16 @@ +from cpl_core.application import StartupABC +from cpl_core.configuration import ConfigurationABC +from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC +from cpl_core.environment import ApplicationEnvironment + + +class Startup(StartupABC): + + def __init__(self): + StartupABC.__init__(self) + + def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: + return configuration + + def configure_services(self, services: ServiceCollectionABC, environment: ApplicationEnvironment) -> ServiceProviderABC: + return services.build_service_provider() diff --git a/src/tests/custom/discord/src/tests/__init__.py b/src/tests/custom/discord/src/tests/__init__.py new file mode 100644 index 00000000..ad5eca30 --- /dev/null +++ b/src/tests/custom/discord/src/tests/__init__.py @@ -0,0 +1 @@ +# imports: