From ffcde046b02e20449919aadaf656368dcf8dd4f2 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 1 Aug 2020 11:58:21 -0400 Subject: [PATCH] Python 3.9 Beta CI added & Fedora 33 Rawhide support (#265) --- .travis.yml | 2 ++ apprise/plugins/NotifySimplePush.py | 17 +++++++++-------- packaging/redhat/python-apprise.spec | 5 ++++- test/test_simplepush_plugin.py | 11 +++++++++-- tox.ini | 12 +++++++++++- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 01ab7ffd..3f492dad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,8 @@ matrix: env: TOXENV=py37 - python: "3.8" env: TOXENV=py38 + - python: "3.9-dev" + env: TOXENV=py39 - python: "pypy2.7-6.0" env: TOXENV=pypy - python: "pypy3.5-6.0" diff --git a/apprise/plugins/NotifySimplePush.py b/apprise/plugins/NotifySimplePush.py index 368e7660..53adfaa1 100644 --- a/apprise/plugins/NotifySimplePush.py +++ b/apprise/plugins/NotifySimplePush.py @@ -142,14 +142,6 @@ class NotifySimplePush(NotifyBase): # Default Event Name self.event = None - # Encrypt Message (providing support is available) - if self.password and self.user and not CRYPTOGRAPHY_AVAILABLE: - # Provide the end user at least some notification that they're - # not getting what they asked for - self.logger.warning( - 'SimplePush extended encryption is not supported by this ' - 'system.') - # Used/cached in _encrypt() function self._iv = None self._iv_hex = None @@ -189,6 +181,15 @@ class NotifySimplePush(NotifyBase): Perform SimplePush Notification """ + # Encrypt Message (providing support is available) + if self.password and self.user and not CRYPTOGRAPHY_AVAILABLE: + # Provide the end user at least some notification that they're + # not getting what they asked for + self.logger.warning( + "Authenticated SimplePush Notifications are not supported by " + "this system; `pip install cryptography`.") + return False + headers = { 'User-Agent': self.app_id, 'Content-type': "application/x-www-form-urlencoded", diff --git a/packaging/redhat/python-apprise.spec b/packaging/redhat/python-apprise.spec index 4ed7065a..b432bad8 100644 --- a/packaging/redhat/python-apprise.spec +++ b/packaging/redhat/python-apprise.spec @@ -82,9 +82,11 @@ BuildRequires: python-six BuildRequires: python2-click >= 5.0 BuildRequires: python-markdown %if 0%{?rhel} && 0%{?rhel} <= 7 +BuildRequires: python-cryptography BuildRequires: python-babel BuildRequires: python-yaml %else +BuildRequires: python2-cryptography BuildRequires: python2-babel BuildRequires: python2-yaml %endif @@ -140,6 +142,7 @@ BuildRequires: python%{python3_pkgversion}-click >= 5.0 BuildRequires: python%{python3_pkgversion}-markdown BuildRequires: python%{python3_pkgversion}-yaml BuildRequires: python%{python3_pkgversion}-babel +BuildRequires: python%{python3_pkgversion}-cryptography Requires: python%{python3_pkgversion}-requests Requires: python%{python3_pkgversion}-requests-oauthlib Requires: python%{python3_pkgversion}-six @@ -179,7 +182,7 @@ BuildRequires: python%{python3_pkgversion}-pytest-runner %endif install -p -D -T -m 0644 packaging/man/%{pypi_name}.1 \ - %{buildroot}%{_mandir}/man1/%{pypi_name}.1 + %{buildroot}%{_mandir}/man1/%{pypi_name}.1 %if %{with tests} %check diff --git a/test/test_simplepush_plugin.py b/test/test_simplepush_plugin.py index 3a6a0764..e605f174 100644 --- a/test/test_simplepush_plugin.py +++ b/test/test_simplepush_plugin.py @@ -25,6 +25,7 @@ import os import sys +import pytest import apprise try: @@ -43,6 +44,8 @@ import logging logging.disable(logging.CRITICAL) +@pytest.mark.skipif( + 'cryptography' not in sys.modules, reason="requires cryptography") def test_simplepush_plugin(tmpdir): """ API: NotifySimplePush Plugin() @@ -73,11 +76,15 @@ def test_simplepush_plugin(tmpdir): reload(sys.modules['apprise.Apprise']) reload(sys.modules['apprise']) - # imported and therefore the extra encryption offered by SimplePush is - # not available... + # Without the cryptography library objects can still be instantiated + # however notifications will fail obj = apprise.Apprise.instantiate('spush://salt:pass@valid_api_key') assert obj is not None + # We can't notify with a user/pass combo and no cryptography library + assert obj.notify( + title="test message title", body="message body") is False + # Tidy-up / restore things to how they were os.unlink(str(suite.join("{}.py".format(module_name)))) reload(sys.modules['apprise.plugins.NotifySimplePush']) diff --git a/tox.ini b/tox.ini index eb4dcbeb..faaf037c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py35,py36,py37,py38,pypy,pypy3,coverage-report +envlist = py27,py35,py36,py37,py38,py39,pypy,pypy3,coverage-report [testenv] @@ -65,6 +65,16 @@ commands = coverage run --parallel -m pytest {posargs} flake8 . --count --show-source --statistics +[testenv:py39] +deps= + dbus-python + -r{toxinidir}/requirements.txt + -r{toxinidir}/dev-requirements.txt +commands = + python setup.py compile_catalog + coverage run --parallel -m pytest {posargs} + flake8 . --count --show-source --statistics + [testenv:pypy] deps= -r{toxinidir}/requirements.txt