Excluded tests from package build

master
Jef Roosens 2020-08-26 14:54:55 +02:00
parent ecdcda1c36
commit df89d6796b
5 changed files with 26 additions and 9 deletions

View File

@ -3,6 +3,7 @@
## Unreleased ## Unreleased
### Added ### Added
- Prefix can now be passed as argument to init - Prefix can now be passed as argument to init
- Pre-made help module
### Fixed ### Fixed
- Buggy 'default' cached_property - Buggy 'default' cached_property

View File

@ -35,6 +35,7 @@ This first part shows the three important variables in any module.
def pre_start(self): def pre_start(self):
self.some_var = 'a value needed for working' self.some_var = 'a value needed for working'
``` ```
The pre_start function is where you define any variables which should be created before any daemons are started or The pre_start function is where you define any variables which should be created before any daemons are started or
commands are run. I don't recommend overwriting `__init__`, as this might break compatibility with future versions of commands are run. I don't recommend overwriting `__init__`, as this might break compatibility with future versions of
Frank. Frank.

View File

@ -46,7 +46,9 @@ class Frank(discord.Client):
self._config = None self._config = None
async def on_ready(self): async def on_ready(self):
"""Runs when the bot has succesfully connected to Discord""" """
Runs when the bot has succesfully connected to Discord
"""
print('Connected') print('Connected')
@ -64,7 +66,9 @@ class Frank(discord.Client):
print('All modules loaded') print('All modules loaded')
async def stop(self): async def stop(self):
"""Stop all module daemons and exit.""" """
Stop all module daemons and exit.
"""
for module in self._loaded_modules: for module in self._loaded_modules:
await module.stop() await module.stop()

View File

@ -24,17 +24,25 @@ if TYPE_CHECKING:
class Module(ModuleMeta): class Module(ModuleMeta):
"""Base class for modules; all custom modules should inherit from this.""" """
Base class for modules; all custom modules should inherit from this.
"""
PREFIX = [] PREFIX = []
"""Prefix to activate this module.""" """
Prefix to activate this module.
"""
NAME = '' NAME = ''
"""The name is used in various places, such as the config file and the """
help function.""" The name is used in various places, such as the config file and the
help function.
"""
HELP = '' HELP = ''
"""Short description of the module to use in the help function.""" """
Short description of the module to use in the help function.
"""
def __init__(self, client: Frank, config: Dict = None): def __init__(self, client: Frank, config: Dict = None):
""" """
@ -43,6 +51,7 @@ class Module(ModuleMeta):
config: dict containing the config for this module (Frank client config: dict containing the config for this module (Frank client
reads this from the config file). reads this from the config file).
""" """
super().__init__() super().__init__()
self._client = client self._client = client
@ -68,7 +77,9 @@ class Module(ModuleMeta):
self._tasks.append(task) self._tasks.append(task)
async def stop(self): async def stop(self):
"""Stop all tasks for this module.""" """
Stop all tasks for this module.
"""
for task in self._tasks: for task in self._tasks:
task.cancel() task.cancel()

View File

@ -18,7 +18,7 @@ setuptools.setup(
long_description=long_description, long_description=long_description,
long_description_content_type='text/markdown', long_description_content_type='text/markdown',
url='https://gitlab.com/Chewing_Bever/frank', url='https://gitlab.com/Chewing_Bever/frank',
packages=setuptools.find_packages(), packages=setuptools.find_packages(exclude=('tests',)),
classifiers=[ classifiers=[
'Development Status :: 3 - Alpha', 'Development Status :: 3 - Alpha',
'Environment :: No Input/Output (Daemon)', 'Environment :: No Input/Output (Daemon)',