diff --git a/dev-requirements.txt b/dev-requirements.txt index b41395ac..6fa025bb 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ coverage flake8 -mock +mock; python_version=='2.7' pytest pytest-cov tox diff --git a/packaging/redhat/python-apprise.spec b/packaging/redhat/python-apprise.spec index 9f9d54c6..632a93ea 100644 --- a/packaging/redhat/python-apprise.spec +++ b/packaging/redhat/python-apprise.spec @@ -60,7 +60,7 @@ Techulus Push, Telegram, Twilio, Twitter, Twist, XBMC, Vonage, Webex Teams} Name: python-%{pypi_name} Version: 1.0.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A simple wrapper to many popular notification services used today License: MIT URL: https://github.com/caronc/%{pypi_name} @@ -161,7 +161,12 @@ Requires: python%{python3_pkgversion}-cryptography Requires: python%{python3_pkgversion}-yaml %if %{with tests} +%if 0%{?rhel} >= 9 +# Do not import python3-mock +%else +# python-mock switched to unittest.mock BuildRequires: python%{python3_pkgversion}-mock +%endif BuildRequires: python%{python3_pkgversion}-pytest BuildRequires: python%{python3_pkgversion}-pytest-runner %endif @@ -183,6 +188,17 @@ rm -f apprise/py3compat/asyncio.py %patch1 -p1 %endif +%if 0%{?rhel} >= 9 +# Nothing to do under normal circumstances; this line here allows legacy +# copies of Apprise to still build against this one +find test -type f -name '*.py' -exec \ + sed -i -e 's|^import mock|from unittest import mock|g' {} \; +%else +# support python-mock (remain backwards compatible with older distributions) +find test -type f -name '*.py' -exec \ + sed -i -e 's|^from unittest import mock|import mock|g' {} \; +%endif + %build %if 0%{?with_python2} %py2_build @@ -243,6 +259,9 @@ LANG=C.UTF-8 PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version %endif %changelog +* Wed Aug 31 2022 Chris Caron - 1.0.0-2 +- Rebuilt for RHEL9 Support + * Sat Aug 6 2022 Chris Caron - 1.0.0-1 - Updated to v1.0.0 diff --git a/test/helpers/rest.py b/test/helpers/rest.py index 30eb891d..3e4f0e77 100644 --- a/test/helpers/rest.py +++ b/test/helpers/rest.py @@ -26,7 +26,14 @@ import re import os import six import requests -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from json import dumps from random import choice from string import ascii_uppercase as str_alpha diff --git a/test/test_api.py b/test/test_api.py index 9f029273..bc1d62e2 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -29,7 +29,14 @@ import sys import six import pytest import requests -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from os.path import dirname from os.path import join diff --git a/test/test_apprise_config.py b/test/test_apprise_config.py index d947d525..998e4174 100644 --- a/test/test_apprise_config.py +++ b/test/test_apprise_config.py @@ -26,7 +26,14 @@ import sys import six import io -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest from apprise import NotifyFormat from apprise import ConfigFormat diff --git a/test/test_attach_base.py b/test/test_attach_base.py index a2281f49..9bab8b0b 100644 --- a/test/test_attach_base.py +++ b/test/test_attach_base.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest from apprise.attachment.AttachBase import AttachBase diff --git a/test/test_attach_file.py b/test/test_attach_file.py index 077a3dcd..a4c335b8 100644 --- a/test/test_attach_file.py +++ b/test/test_attach_file.py @@ -25,7 +25,14 @@ import re import time -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from os.path import dirname from os.path import join from apprise.attachment.AttachBase import AttachBase diff --git a/test/test_attach_http.py b/test/test_attach_http.py index bd029495..6a4761ae 100644 --- a/test/test_attach_http.py +++ b/test/test_attach_http.py @@ -25,7 +25,14 @@ import re import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests import mimetypes from os.path import join diff --git a/test/test_cli.py b/test/test_cli.py index 7a453185..f3b1c80e 100644 --- a/test/test_cli.py +++ b/test/test_cli.py @@ -24,7 +24,14 @@ # THE SOFTWARE. from __future__ import print_function import re -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests import json from inspect import cleandoc diff --git a/test/test_config_file.py b/test/test_config_file.py index abf990fa..6ca5e4de 100644 --- a/test/test_config_file.py +++ b/test/test_config_file.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from apprise.config.ConfigFile import ConfigFile from apprise.plugins.NotifyBase import NotifyBase from apprise.AppriseAsset import AppriseAsset diff --git a/test/test_config_http.py b/test/test_config_http.py index 6a564ab0..ee68a096 100644 --- a/test/test_config_http.py +++ b/test/test_config_http.py @@ -26,7 +26,14 @@ import six import time import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise.common import ConfigFormat from apprise.config.ConfigHTTP import ConfigHTTP diff --git a/test/test_custom_json_plugin.py b/test/test_custom_json_plugin.py index a05f24d9..e132b356 100644 --- a/test/test_custom_json_plugin.py +++ b/test/test_custom_json_plugin.py @@ -25,7 +25,14 @@ import os import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from apprise import Apprise diff --git a/test/test_escapes.py b/test/test_escapes.py index 66e06abc..8a32b1c6 100644 --- a/test/test_escapes.py +++ b/test/test_escapes.py @@ -27,7 +27,14 @@ import sys from json import loads import pytest import requests -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import apprise diff --git a/test/test_locale.py b/test/test_locale.py index 90831718..49f8e3fb 100644 --- a/test/test_locale.py +++ b/test/test_locale.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import ctypes from apprise import AppriseLocale diff --git a/test/test_logger.py b/test/test_logger.py index 9e2d963c..ebf1a7f7 100644 --- a/test/test_logger.py +++ b/test/test_logger.py @@ -26,7 +26,14 @@ import re import os import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import Apprise diff --git a/test/test_plugin_boxcar.py b/test/test_plugin_boxcar.py index 3297f1af..4b69d24d 100644 --- a/test/test_plugin_boxcar.py +++ b/test/test_plugin_boxcar.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from helpers import AppriseURLTester from apprise import plugins from apprise import NotifyType diff --git a/test/test_plugin_custom_form.py b/test/test_plugin_custom_form.py index 104f2d5e..ad169d8f 100644 --- a/test/test_plugin_custom_form.py +++ b/test/test_plugin_custom_form.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from helpers import AppriseURLTester diff --git a/test/test_plugin_custom_json.py b/test/test_plugin_custom_json.py index d3e172a9..620278a8 100644 --- a/test/test_plugin_custom_json.py +++ b/test/test_plugin_custom_json.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import json -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from helpers import AppriseURLTester diff --git a/test/test_plugin_custom_xml.py b/test/test_plugin_custom_xml.py index 76ab8dd9..d1e385c9 100644 --- a/test/test_plugin_custom_xml.py +++ b/test/test_plugin_custom_xml.py @@ -25,7 +25,14 @@ import os import sys import re -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from apprise import Apprise diff --git a/test/test_plugin_dapnet.py b/test/test_plugin_dapnet.py index 885dd831..eb218d5f 100644 --- a/test/test_plugin_dapnet.py +++ b/test/test_plugin_dapnet.py @@ -25,7 +25,14 @@ # Disable logging for a cleaner testing output import logging import requests -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import apprise from apprise.plugins.NotifyDapnet import DapnetPriority diff --git a/test/test_plugin_discord.py b/test/test_plugin_discord.py index 41572959..0df36c86 100644 --- a/test/test_plugin_discord.py +++ b/test/test_plugin_discord.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from helpers import AppriseURLTester diff --git a/test/test_plugin_email.py b/test/test_plugin_email.py index d468385d..da103d6c 100644 --- a/test/test_plugin_email.py +++ b/test/test_plugin_email.py @@ -26,7 +26,14 @@ import os import re import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import smtplib from email.header import decode_header diff --git a/test/test_plugin_emby.py b/test/test_plugin_emby.py index 1daebc65..05597329 100644 --- a/test/test_plugin_emby.py +++ b/test/test_plugin_emby.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from json import dumps from apprise import Apprise from apprise import plugins diff --git a/test/test_plugin_fcm.py b/test/test_plugin_fcm.py index 08e696a0..ffe85d18 100644 --- a/test/test_plugin_fcm.py +++ b/test/test_plugin_fcm.py @@ -33,7 +33,14 @@ import io import os import six import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests import json diff --git a/test/test_plugin_flock.py b/test/test_plugin_flock.py index 5657eae9..0df3f299 100644 --- a/test/test_plugin_flock.py +++ b/test/test_plugin_flock.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_gitter.py b/test/test_plugin_gitter.py index c1ce46c4..5b73f2be 100644 --- a/test/test_plugin_gitter.py +++ b/test/test_plugin_gitter.py @@ -25,7 +25,14 @@ import six import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from helpers import AppriseURLTester from apprise import plugins diff --git a/test/test_plugin_glib.py b/test/test_plugin_glib.py index 1bd34096..9b5b4674 100644 --- a/test/test_plugin_glib.py +++ b/test/test_plugin_glib.py @@ -26,7 +26,14 @@ import re import six import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import sys import types import apprise diff --git a/test/test_plugin_gnome.py b/test/test_plugin_gnome.py index 98ecc071..79ae4401 100644 --- a/test/test_plugin_gnome.py +++ b/test/test_plugin_gnome.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import sys import types import pytest diff --git a/test/test_plugin_gotify.py b/test/test_plugin_gotify.py index 9fb4213c..5c68d55e 100644 --- a/test/test_plugin_gotify.py +++ b/test/test_plugin_gotify.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests import apprise diff --git a/test/test_plugin_growl.py b/test/test_plugin_growl.py index 8fbe9638..c81488db 100644 --- a/test/test_plugin_growl.py +++ b/test/test_plugin_growl.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import six import pytest import apprise diff --git a/test/test_plugin_guilded.py b/test/test_plugin_guilded.py index 7e1530f3..1ade673d 100644 --- a/test/test_plugin_guilded.py +++ b/test/test_plugin_guilded.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from helpers import AppriseURLTester diff --git a/test/test_plugin_homeassistant.py b/test/test_plugin_homeassistant.py index 08d4d25f..e0fa64ca 100644 --- a/test/test_plugin_homeassistant.py +++ b/test/test_plugin_homeassistant.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from apprise import Apprise diff --git a/test/test_plugin_ifttt.py b/test/test_plugin_ifttt.py index 5847ae66..c7bbe442 100644 --- a/test/test_plugin_ifttt.py +++ b/test/test_plugin_ifttt.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from apprise import NotifyType diff --git a/test/test_plugin_join.py b/test/test_plugin_join.py index bd8a69c7..c0449e40 100644 --- a/test/test_plugin_join.py +++ b/test/test_plugin_join.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests import apprise diff --git a/test/test_plugin_macosx.py b/test/test_plugin_macosx.py index 2fc617dc..142864b9 100644 --- a/test/test_plugin_macosx.py +++ b/test/test_plugin_macosx.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from helpers import module_reload import apprise diff --git a/test/test_plugin_mailgun.py b/test/test_plugin_mailgun.py index 576ec48c..2d5c4889 100644 --- a/test/test_plugin_mailgun.py +++ b/test/test_plugin_mailgun.py @@ -25,7 +25,14 @@ import os import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from helpers import AppriseURLTester from apprise import plugins diff --git a/test/test_plugin_matrix.py b/test/test_plugin_matrix.py index 01f8b426..4e4f2946 100644 --- a/test/test_plugin_matrix.py +++ b/test/test_plugin_matrix.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests import pytest from apprise import plugins diff --git a/test/test_plugin_messagebird.py b/test/test_plugin_messagebird.py index 42303f07..db31774f 100644 --- a/test/test_plugin_messagebird.py +++ b/test/test_plugin_messagebird.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_mqtt.py b/test/test_plugin_mqtt.py index 2ec57668..5c8ec0e2 100644 --- a/test/test_plugin_mqtt.py +++ b/test/test_plugin_mqtt.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import re import sys import ssl diff --git a/test/test_plugin_msg91.py b/test/test_plugin_msg91.py index 556fb77b..383364bc 100644 --- a/test/test_plugin_msg91.py +++ b/test/test_plugin_msg91.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_msteams.py b/test/test_plugin_msteams.py index b47ea618..c79045ed 100644 --- a/test/test_plugin_msteams.py +++ b/test/test_plugin_msteams.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import json import requests import pytest diff --git a/test/test_plugin_nextcloud.py b/test/test_plugin_nextcloud.py index c578f5c1..3adf3e0f 100644 --- a/test/test_plugin_nextcloud.py +++ b/test/test_plugin_nextcloud.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from helpers import AppriseURLTester diff --git a/test/test_plugin_nextcloudtalk.py b/test/test_plugin_nextcloudtalk.py index 104422e0..048205b7 100644 --- a/test/test_plugin_nextcloudtalk.py +++ b/test/test_plugin_nextcloudtalk.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from helpers import AppriseURLTester diff --git a/test/test_plugin_ntfy.py b/test/test_plugin_ntfy.py index fa86fe67..370f5c68 100644 --- a/test/test_plugin_ntfy.py +++ b/test/test_plugin_ntfy.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os import json -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins import apprise diff --git a/test/test_plugin_office365.py b/test/test_plugin_office365.py index ab8ff1ce..7ddd7df2 100644 --- a/test/test_plugin_office365.py +++ b/test/test_plugin_office365.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from datetime import datetime diff --git a/test/test_plugin_opsgenie.py b/test/test_plugin_opsgenie.py index 0748c4c0..4f77cf6b 100644 --- a/test/test_plugin_opsgenie.py +++ b/test/test_plugin_opsgenie.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise.plugins.NotifyOpsgenie import OpsgeniePriority import apprise diff --git a/test/test_plugin_prowl.py b/test/test_plugin_prowl.py index d0d69b2a..6528d630 100644 --- a/test/test_plugin_prowl.py +++ b/test/test_plugin_prowl.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise.plugins.NotifyProwl import ProwlPriority diff --git a/test/test_plugin_pushbullet.py b/test/test_plugin_pushbullet.py index 45b5e011..d55fab07 100644 --- a/test/test_plugin_pushbullet.py +++ b/test/test_plugin_pushbullet.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from json import dumps diff --git a/test/test_plugin_pushed.py b/test/test_plugin_pushed.py index 8e42bba6..6612a94e 100644 --- a/test/test_plugin_pushed.py +++ b/test/test_plugin_pushed.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_pushover.py b/test/test_plugin_pushover.py index fe65cd72..d1ca5ae8 100644 --- a/test/test_plugin_pushover.py +++ b/test/test_plugin_pushover.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests import pytest from json import dumps diff --git a/test/test_plugin_pushsafer.py b/test/test_plugin_pushsafer.py index 35f8a2be..2c1b69ed 100644 --- a/test/test_plugin_pushsafer.py +++ b/test/test_plugin_pushsafer.py @@ -25,7 +25,14 @@ import os import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from json import dumps from apprise import AppriseAttachment diff --git a/test/test_plugin_reddit.py b/test/test_plugin_reddit.py index 95a10c80..431032d7 100644 --- a/test/test_plugin_reddit.py +++ b/test/test_plugin_reddit.py @@ -25,7 +25,14 @@ import six import requests -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + from apprise import plugins from helpers import AppriseURLTester diff --git a/test/test_plugin_rocket_chat.py b/test/test_plugin_rocket_chat.py index e39c2f16..805319c3 100644 --- a/test/test_plugin_rocket_chat.py +++ b/test/test_plugin_rocket_chat.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_sendgrid.py b/test/test_plugin_sendgrid.py index 84b0de22..8f457c63 100644 --- a/test/test_plugin_sendgrid.py +++ b/test/test_plugin_sendgrid.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_ses.py b/test/test_plugin_ses.py index 2cfca266..5ea00692 100644 --- a/test/test_plugin_ses.py +++ b/test/test_plugin_ses.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import os -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import Apprise diff --git a/test/test_plugin_signal.py b/test/test_plugin_signal.py index 77b5d158..845694c3 100644 --- a/test/test_plugin_signal.py +++ b/test/test_plugin_signal.py @@ -25,7 +25,14 @@ import os import sys from json import loads -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_simplepush.py b/test/test_plugin_simplepush.py index be93fb72..9c6e9a95 100644 --- a/test/test_plugin_simplepush.py +++ b/test/test_plugin_simplepush.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests import json diff --git a/test/test_plugin_sinch.py b/test/test_plugin_sinch.py index 75e73b0a..59275a06 100644 --- a/test/test_plugin_sinch.py +++ b/test/test_plugin_sinch.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from json import dumps diff --git a/test/test_plugin_slack.py b/test/test_plugin_slack.py index 337df915..950dfdf9 100644 --- a/test/test_plugin_slack.py +++ b/test/test_plugin_slack.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_smtp2go.py b/test/test_plugin_smtp2go.py index 198f6f21..e4287717 100644 --- a/test/test_plugin_smtp2go.py +++ b/test/test_plugin_smtp2go.py @@ -25,7 +25,14 @@ import os import sys -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from apprise import plugins from apprise import Apprise diff --git a/test/test_plugin_sns.py b/test/test_plugin_sns.py index f06ca80c..1ef4fc56 100644 --- a/test/test_plugin_sns.py +++ b/test/test_plugin_sns.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from apprise import plugins diff --git a/test/test_plugin_sparkpost.py b/test/test_plugin_sparkpost.py index 9e1be21a..6d5c3a3f 100644 --- a/test/test_plugin_sparkpost.py +++ b/test/test_plugin_sparkpost.py @@ -25,7 +25,14 @@ import os import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from json import dumps from apprise import plugins diff --git a/test/test_plugin_syslog.py b/test/test_plugin_syslog.py index 71f96226..bdc264ce 100644 --- a/test/test_plugin_syslog.py +++ b/test/test_plugin_syslog.py @@ -25,7 +25,14 @@ import re import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import apprise import socket diff --git a/test/test_plugin_telegram.py b/test/test_plugin_telegram.py index 147ad4a7..666dad8f 100644 --- a/test/test_plugin_telegram.py +++ b/test/test_plugin_telegram.py @@ -27,7 +27,14 @@ import os import six import sys import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from json import dumps from json import loads diff --git a/test/test_plugin_twilio.py b/test/test_plugin_twilio.py index e8b56363..07d79058 100644 --- a/test/test_plugin_twilio.py +++ b/test/test_plugin_twilio.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests import pytest from json import dumps diff --git a/test/test_plugin_twist.py b/test/test_plugin_twist.py index 5e0eff9c..1dbd5e12 100644 --- a/test/test_plugin_twist.py +++ b/test/test_plugin_twist.py @@ -23,7 +23,14 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import requests from json import dumps from apprise import plugins diff --git a/test/test_plugin_twitter.py b/test/test_plugin_twitter.py index 34878a3e..9c50c3cc 100644 --- a/test/test_plugin_twitter.py +++ b/test/test_plugin_twitter.py @@ -25,7 +25,14 @@ import os import six -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from json import dumps diff --git a/test/test_plugin_vonage.py b/test/test_plugin_vonage.py index a8f79a8c..3606ec09 100644 --- a/test/test_plugin_vonage.py +++ b/test/test_plugin_vonage.py @@ -22,7 +22,14 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import pytest import requests from json import dumps diff --git a/test/test_plugin_windows.py b/test/test_plugin_windows.py index 2442325c..f9377716 100644 --- a/test/test_plugin_windows.py +++ b/test/test_plugin_windows.py @@ -24,7 +24,14 @@ # THE SOFTWARE. import pytest -import mock +try: + # Python 3.x + from unittest import mock + +except ImportError: + # Python 2.7 + import mock + import sys import six import types