From 2e583ef9a388058b9bcb303911e7c8507c32b11a Mon Sep 17 00:00:00 2001 From: Mateusz Stankiewicz Date: Wed, 16 Dec 2020 14:46:32 +0100 Subject: [PATCH] PYEK-31 | Subscriber returns 400 on TypeError, make linter fine, drop 2.7, 3.4, 3.5 --- pyhermes/__init__.py | 2 +- pyhermes/apps/flask/blueprints.py | 8 ++++---- pyhermes/management.py | 14 +++++++------- requirements/dev.txt | 4 ++-- setup.cfg | 2 +- setup.py | 7 +++---- tox.ini | 17 +++++++---------- 7 files changed, 25 insertions(+), 29 deletions(-) diff --git a/pyhermes/__init__.py b/pyhermes/__init__.py index 22e5f72..7a686fd 100644 --- a/pyhermes/__init__.py +++ b/pyhermes/__init__.py @@ -1,7 +1,7 @@ from pyhermes.decorators import publisher, subscriber from pyhermes.publishing import publish -__version__ = '0.4.2' +__version__ = '0.4.3' __all__ = [ 'publish', diff --git a/pyhermes/apps/flask/blueprints.py b/pyhermes/apps/flask/blueprints.py index bcc6d8d..472f9ce 100644 --- a/pyhermes/apps/flask/blueprints.py +++ b/pyhermes/apps/flask/blueprints.py @@ -19,9 +19,9 @@ def subscriber_view(subscriber_name): except TopicHandlersNotFoundError: logger.error('subscriber `{}` does not exist.'.format(subscriber_name)) return abort(404) - except ValueError: - # json loading error - # TODO: better handling + except (ValueError, TypeError) as e: + # Input loading error + logger.error(str(e)) return abort(400) else: - return ('', 204) + return '', 204 diff --git a/pyhermes/management.py b/pyhermes/management.py index ee2d22f..3d32eb9 100644 --- a/pyhermes/management.py +++ b/pyhermes/management.py @@ -9,14 +9,14 @@ def integrations_command_handler(topic, message): from pyhermes.publishing import publish from pyhermes.settings import HERMES_SETTINGS if not HERMES_SETTINGS.ENABLED: - sys.stderr.write( - 'Hermes integration is disabled. ' - 'Check HERMES.ENABLED variable ' - 'in your settings or environment.' - ) - return + sys.stderr.write( + 'Hermes integration is disabled. ' + 'Check HERMES.ENABLED variable ' + 'in your settings or environment.' + ) + return if topic == TOPICS_ALL: - topics = HERMES_SETTINGS.PUBLISHING_TOPICS.keys() + topics = HERMES_SETTINGS.PUBLISHING_TOPICS.keys() else: topics = [topic] diff --git a/requirements/dev.txt b/requirements/dev.txt index dae10f6..79f1ec0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,2 +1,2 @@ -bumpversion==0.5.3 -wheel==0.24.0 +bumpversion==0.6.0 +wheel==0.36.2 diff --git a/setup.cfg b/setup.cfg index a1711a0..5569f4d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.4.2 +current_version = 0.4.3 commit = True tag = True diff --git a/setup.py b/setup.py index e97a6e1..36e44b4 100755 --- a/setup.py +++ b/setup.py @@ -68,10 +68,9 @@ def get_version(*file_paths): 'Intended Audience :: Developers', 'License :: OSI Approved :: Apache Software License', 'Natural Language :: English', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', ], ) diff --git a/tox.ini b/tox.ini index fc38351..403f9ad 100644 --- a/tox.ini +++ b/tox.ini @@ -1,9 +1,8 @@ [tox] envlist = - {py27,py34,py35,py36} - {py27,py34,py35,py36}-django{18,19,110,111,dev}, - {py27,py34}-django{17}, - {py27,py34,py35,py36}-flask{012,10,dev}, + {py36,py37,py38} + {py36,py37,py38}-django{111,dev}, + {py36,py37,py38}-flask{125,10,dev}, [testenv] setenv = @@ -18,11 +17,9 @@ setenv = PYTHONPATH = {toxinidir}:{toxinidir}/pyhermes commands = python runtests_django.py tests/test_apps/test_django/ deps = - django17: Django==1.7.11 - django18: Django==1.8.17 - django19: Django==1.9.12 - django110: Django==1.10.4 - django111: Django==1.11.a1 + django111: Django==1.11.29 + django2: Django==2.2.17 + django31: Django==3.1.4 djangodev: git+git://github.com/django/django.git -r{toxinidir}/requirements/test.txt @@ -32,7 +29,7 @@ setenv = PYTHONPATH = {toxinidir}:{toxinidir}/pyhermes commands = python -m unittest discover tests/test_apps/test_flask/ deps = - flask122: Flask==0.12.2 + flask125: Flask==0.12.5 flask10: Flask==1.0.2 flaskdev: git+git://github.com/pallets/flask.git -r{toxinidir}/requirements/test.txt