Refactor: Python Module Naming & Namespace Harmonization (#1119)

This commit is contained in:
Chris Caron
2024-04-27 13:02:27 -04:00
committed by GitHub
parent 08cb018e11
commit b8da1334ab
267 changed files with 678 additions and 639 deletions

View File

@ -33,8 +33,8 @@ import threading
from inspect import cleandoc
from apprise import Apprise
from apprise.NotificationManager import NotificationManager
from apprise.plugins.NotifyBase import NotifyBase
from apprise.manager_plugins import NotificationManager
from apprise.plugins import NotifyBase
# Disable logging for a cleaner testing output
import logging
@ -346,7 +346,7 @@ def test_notification_manager_decorators(tmpdir):
#
# Bare Minimum Valid Object
#
from apprise.plugins.NotifyBase import NotifyBase
from apprise.plugins import NotifyBase
from apprise.common import NotifyType
class NotifyTest(NotifyBase):
@ -356,7 +356,7 @@ def test_notification_manager_decorators(tmpdir):
# The services URL
service_url = 'https://github.com/caronc/apprise/'
# All boxcar notifications are secure
# Define our protocol
secure_protocol = 'mytest'
# A URL that takes you to the setup/help of the specific protocol
@ -382,42 +382,6 @@ def test_notification_manager_decorators(tmpdir):
del N_MGR['mytest']
assert 'mytest' not in N_MGR
# Prepare ourselves a file to work with
notify_test = notify_base.join('NotifyNoAlign.py')
notify_test.write(cleandoc("""
#
# Bare Minimum Valid Object
#
from apprise.plugins.NotifyBase import NotifyBase
from apprise.common import NotifyType
class NotifyDifferentName(NotifyBase):
service_name = 'Unloadable'
# The services URL
service_url = 'https://github.com/caronc/apprise/'
# All boxcar notifications are secure
secure_protocol = 'noload'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_mytest'
# Define object templates
templates = (
'{schema}://',
)
def __init__(self, **kwargs):
super().__init__(**kwargs)
def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs):
return True
def url(self):
return 'mytest://'
"""))
assert 'mytest' not in N_MGR
N_MGR.load_modules(path=str(notify_base))
@ -426,10 +390,6 @@ def test_notification_manager_decorators(tmpdir):
N_MGR.load_modules(path=str(notify_base), force=True)
assert 'mytest' in N_MGR
# Could not be loaded because the filename did not align with the class
# name.
assert 'noload' not in N_MGR
# Double load will test section of code that prevents a notification
# From reloading if previously already loaded
N_MGR.load_modules(path=str(notify_base))