Added support for recent CPython and PyPy versions; Droped Python v2.7 Support (#680)

This commit is contained in:
Andreas Motl
2022-10-08 02:28:36 +02:00
committed by GitHub
parent f7244cce3d
commit 00afe4e5b6
164 changed files with 746 additions and 2787 deletions

View File

@@ -24,14 +24,7 @@
# THE SOFTWARE.
import os
import sys
try:
# Python 3.x
from unittest import mock
except ImportError:
# Python 2.7
import mock
from unittest import mock
import requests
from apprise import plugins
@@ -204,13 +197,6 @@ def test_plugin_smtp2go_attachments(mock_post):
body='body', title='title', notify_type=NotifyType.INFO,
attach=attach) is False
# Get a appropriate "builtin" module name for pythons 2/3.
if sys.version_info.major >= 3:
builtin_open_function = 'builtins.open'
else:
builtin_open_function = '__builtin__.open'
# Test Valid Attachment (load 3)
path = (
os.path.join(TEST_VAR_DIR, 'apprise-test.gif'),
@@ -222,7 +208,7 @@ def test_plugin_smtp2go_attachments(mock_post):
# Return our good configuration
mock_post.side_effect = None
mock_post.return_value = okay_response
with mock.patch(builtin_open_function, side_effect=OSError()):
with mock.patch('builtins.open', side_effect=OSError()):
# We can't send the message we can't open the attachment for reading
assert obj.notify(
body='body', title='title', notify_type=NotifyType.INFO,