From 604bb8f55c86168fa3352162ac1d4d7f05c33941 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 8 Dec 2022 11:02:54 +0100 Subject: [PATCH] Updated discord test app #143 --- .../discord/src/discord_bot/__init__.py | 25 +++++++++++++++++++ .../discord/src/discord_bot/discord-bot.json | 8 +++--- tests/custom/discord/src/discord_bot/main.py | 8 +++--- .../custom/discord/src/discord_bot/startup.py | 3 ++- .../src/modules/hello_world/__init__.py | 25 +++++++++++++++++++ .../src/modules/hello_world/hello-world.json | 8 +++--- 6 files changed, 65 insertions(+), 12 deletions(-) diff --git a/tests/custom/discord/src/discord_bot/__init__.py b/tests/custom/discord/src/discord_bot/__init__.py index ad5eca30..b91b4151 100644 --- a/tests/custom/discord/src/discord_bot/__init__.py +++ b/tests/custom/discord/src/discord_bot/__init__.py @@ -1 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +discord-bot +~~~~~~~~~~~~~~~~~~~ + + + +:copyright: (c) +:license: + +""" + +__title__ = 'discord_bot' +__author__ = '' +__license__ = '' +__copyright__ = 'Copyright (c) ' +__version__ = '0.0.0' + +from collections import namedtuple + + # imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='0', minor='0', micro='0') diff --git a/tests/custom/discord/src/discord_bot/discord-bot.json b/tests/custom/discord/src/discord_bot/discord-bot.json index c543ea19..4a1b4bb2 100644 --- a/tests/custom/discord/src/discord_bot/discord-bot.json +++ b/tests/custom/discord/src/discord_bot/discord-bot.json @@ -16,10 +16,10 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.7.0" + "cpl-core==2022.12.0" ], "DevDependencies": [ - "cpl-cli>=2022.7.0" + "cpl-cli==2022.12.0" ], "PythonVersion": ">=3.10.4", "PythonPath": {}, @@ -39,6 +39,8 @@ "*/tests" ], "PackageData": {}, - "ProjectReferences": [] + "ProjectReferences": [ + "../modules/hello_world/hello-world.json" + ] } } \ No newline at end of file diff --git a/tests/custom/discord/src/discord_bot/main.py b/tests/custom/discord/src/discord_bot/main.py index 669645fe..bb67168b 100644 --- a/tests/custom/discord/src/discord_bot/main.py +++ b/tests/custom/discord/src/discord_bot/main.py @@ -7,7 +7,7 @@ from discord_bot.application import Application from discord_bot.startup import Startup -class Main: +class Program: def __init__(self): self._app: Optional[Application] = None @@ -23,8 +23,8 @@ class Main: if __name__ == '__main__': - main = Main() + program = Program() try: - asyncio.run(main.main()) + asyncio.run(program.main()) except KeyboardInterrupt: - asyncio.run(main.stop()) + asyncio.run(program.stop()) diff --git a/tests/custom/discord/src/discord_bot/startup.py b/tests/custom/discord/src/discord_bot/startup.py index 11599cb2..5108e27c 100644 --- a/tests/custom/discord/src/discord_bot/startup.py +++ b/tests/custom/discord/src/discord_bot/startup.py @@ -1,5 +1,6 @@ from cpl_core.application import StartupABC from cpl_core.configuration import ConfigurationABC +from cpl_core.console import Console from cpl_core.dependency_injection import ServiceProviderABC, ServiceCollectionABC from cpl_core.environment import ApplicationEnvironment from cpl_discord import get_discord_collection @@ -16,7 +17,7 @@ class Startup(StartupABC): StartupABC.__init__(self) def configure_configuration(self, configuration: ConfigurationABC, environment: ApplicationEnvironment) -> ConfigurationABC: - configuration.add_json_file('appsettings.json', optional=True) + configuration.add_json_file('appsettings.json', optional=False) configuration.add_environment_variables('CPL_') configuration.add_environment_variables('DISCORD_') diff --git a/tests/custom/discord/src/modules/hello_world/__init__.py b/tests/custom/discord/src/modules/hello_world/__init__.py index ad5eca30..c576f0a0 100644 --- a/tests/custom/discord/src/modules/hello_world/__init__.py +++ b/tests/custom/discord/src/modules/hello_world/__init__.py @@ -1 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +discord-bot +~~~~~~~~~~~~~~~~~~~ + + + +:copyright: (c) +:license: + +""" + +__title__ = 'modules.hello_world' +__author__ = '' +__license__ = '' +__copyright__ = 'Copyright (c) ' +__version__ = '0.0.0' + +from collections import namedtuple + + # imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='0', minor='0', micro='0') diff --git a/tests/custom/discord/src/modules/hello_world/hello-world.json b/tests/custom/discord/src/modules/hello_world/hello-world.json index f5dd8fcc..459a531b 100644 --- a/tests/custom/discord/src/modules/hello_world/hello-world.json +++ b/tests/custom/discord/src/modules/hello_world/hello-world.json @@ -16,10 +16,10 @@ "LicenseName": "", "LicenseDescription": "", "Dependencies": [ - "cpl-core>=2022.7.0" + "cpl-core==2022.12.0" ], "DevDependencies": [ - "cpl-cli>=2022.7.0.post1" + "cpl-cli==2022.12.0" ], "PythonVersion": ">=3.10.4", "PythonPath": {}, @@ -29,8 +29,8 @@ "ProjectType": "library", "SourcePath": "", "OutputPath": "../../dist", - "Main": "hello_world.main", - "EntryPoint": "hello-world", + "Main": "", + "EntryPoint": "", "IncludePackageData": false, "Included": [], "Excluded": [