mirror of
https://github.com/caronc/apprise.git
synced 2025-08-13 18:17:12 +02:00
Apprise @notify decorator/plugin support (#625)
This commit is contained in:
@ -25,22 +25,11 @@
|
||||
|
||||
import os
|
||||
import six
|
||||
import sys
|
||||
import mock
|
||||
from helpers import module_reload
|
||||
|
||||
import apprise
|
||||
|
||||
try:
|
||||
# Python v3.4+
|
||||
from importlib import reload
|
||||
except ImportError:
|
||||
try:
|
||||
# Python v3.0-v3.3
|
||||
from imp import reload
|
||||
except ImportError:
|
||||
# Python v2.7
|
||||
pass
|
||||
|
||||
# Disable logging for a cleaner testing output
|
||||
import logging
|
||||
logging.disable(logging.CRITICAL)
|
||||
@ -71,10 +60,7 @@ def test_plugin_macosx_general(mock_macver, mock_system, mock_popen, tmpdir):
|
||||
mock_popen.return_value = mock_cmd_response
|
||||
|
||||
# Ensure our enviroment is loaded with this configuration
|
||||
reload(sys.modules['apprise.plugins.NotifyMacOSX'])
|
||||
reload(sys.modules['apprise.plugins'])
|
||||
reload(sys.modules['apprise.Apprise'])
|
||||
reload(sys.modules['apprise'])
|
||||
module_reload('NotifyMacOSX')
|
||||
|
||||
# Point our object to our new temporary existing file
|
||||
apprise.plugins.NotifyMacOSX.notify_paths = (str(script), )
|
||||
@ -144,10 +130,7 @@ def test_plugin_macosx_general(mock_macver, mock_system, mock_popen, tmpdir):
|
||||
|
||||
# Test case where we simply aren't on a mac
|
||||
mock_system.return_value = 'Linux'
|
||||
reload(sys.modules['apprise.plugins.NotifyMacOSX'])
|
||||
reload(sys.modules['apprise.plugins'])
|
||||
reload(sys.modules['apprise.Apprise'])
|
||||
reload(sys.modules['apprise'])
|
||||
module_reload('NotifyMacOSX')
|
||||
|
||||
# Point our object to our new temporary existing file
|
||||
apprise.plugins.NotifyMacOSX.notify_paths = (str(script), )
|
||||
@ -162,10 +145,7 @@ def test_plugin_macosx_general(mock_macver, mock_system, mock_popen, tmpdir):
|
||||
|
||||
# Now we must be Mac OS v10.8 or higher...
|
||||
mock_macver.return_value = ('10.7', ('', '', ''), '')
|
||||
reload(sys.modules['apprise.plugins.NotifyMacOSX'])
|
||||
reload(sys.modules['apprise.plugins'])
|
||||
reload(sys.modules['apprise.Apprise'])
|
||||
reload(sys.modules['apprise'])
|
||||
module_reload('NotifyMacOSX')
|
||||
|
||||
# Point our object to our new temporary existing file
|
||||
apprise.plugins.NotifyMacOSX.notify_paths = (str(script), )
|
||||
@ -176,10 +156,7 @@ def test_plugin_macosx_general(mock_macver, mock_system, mock_popen, tmpdir):
|
||||
|
||||
# A newer environment to test edge case where this is tested
|
||||
mock_macver.return_value = ('9.12', ('', '', ''), '')
|
||||
reload(sys.modules['apprise.plugins.NotifyMacOSX'])
|
||||
reload(sys.modules['apprise.plugins'])
|
||||
reload(sys.modules['apprise.Apprise'])
|
||||
reload(sys.modules['apprise'])
|
||||
module_reload('NotifyMacOSX')
|
||||
|
||||
# Point our object to our new temporary existing file
|
||||
apprise.plugins.NotifyMacOSX.notify_paths = (str(script), )
|
||||
|
Reference in New Issue
Block a user