Skip to content

Commit

Permalink
Update To Python 3.8 and 3.9, drop support for every below
Browse files Browse the repository at this point in the history
  • Loading branch information
lbedner committed Jan 8, 2021
1 parent 7315062 commit d9f3474
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 43 deletions.
22 changes: 11 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# Use Python
language: python

# Run the test runner using the same version of Python we use.
python: 3.5
matrix:
include:
- python: 3.8
env: TOX_ENV=py38
- python: 3.9
env: TOX_ENV=py39
- python: 3.9
env: TOX_ENV=docs
- python: 3.9
env: TOX_ENV=pep8

# Install the test runner.
install: pip install tox

# Run each environment separately so we get errors back from all of them.
env:
- TOX_ENV=py35
- TOX_ENV=py34
- TOX_ENV=pep8
- TOX_ENV=docs
script:
- tox -e $TOX_ENV
script: tox -e $TOX_ENV

# Control the branches that get built.
branches:
Expand Down
15 changes: 5 additions & 10 deletions henson_sentry.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""A Henson plugin to integrate Sentry."""

import asyncio
import os as _os
import pkg_resources as _pkg_resources

Expand Down Expand Up @@ -67,26 +66,22 @@ def init_app(self, app):
app.error(self._handle_exception)
app.message_acknowledgement(self._after_message)

@asyncio.coroutine
def capture_exception(self, exc_info=None, **kwargs):
async def capture_exception(self, exc_info=None, **kwargs):
"""Create an event from an exception."""
self._client.captureException(exc_info, **kwargs)

@asyncio.coroutine
def capture_message(self, message, **kwargs):
async def capture_message(self, message, **kwargs):
"""Create an event from ``message``."""
self._client.captureMessage(message, **kwargs)

@asyncio.coroutine
def _after_message(self, app, message):
async def _after_message(self, app, message):
self._client.context.clear()

@asyncio.coroutine
def _handle_exception(self, app, message, exc):
async def _handle_exception(self, app, message, exc):
if isinstance(exc, self.app.settings['RAVEN_IGNORE_EXCEPTIONS']):
return

yield from self.capture_exception(message=message)
await self.capture_exception(message=message)


def _make_client(app):
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def read(filename):
setup(
name='Henson-Sentry',
version='0.4.0',
author='Andy Dirnberger',
author_email='[email protected]',
author='Andy Dirnberger, Leonard Bedner, and others',
author_email='[email protected]',
url='https://henson-sentry.readthedocs.io',
description='A library for integrating Sentry into a Henson application',
long_description=read('README.rst'),
Expand All @@ -46,8 +46,8 @@ def read(filename):
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Software Development',
]
Expand Down
9 changes: 3 additions & 6 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def send(self, **kwargs):


class MockConsumer:
@asyncio.coroutine
def read(self):
async def read(self):
return 1


Expand Down Expand Up @@ -57,16 +56,14 @@ def sentry(test_client, test_app):
@pytest.fixture
def test_app(test_consumer, event_loop):
"""Return a test application."""
@asyncio.coroutine
def callback(app, message):
async def callback(app, message):
raise Exception('testing')

app = Application('testing', callback=callback, consumer=test_consumer)
app.settings['SENTRY_DSN'] = 'testing'

@app.message_acknowledgement
@asyncio.coroutine
def stop_loop(app, message):
async def stop_loop(app, message):
event_loop.stop()

return app
Expand Down
12 changes: 4 additions & 8 deletions tests/test_sentry.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
"""Test Henson-Sentry."""

import asyncio

from henson_sentry import Sentry


def test_capture_exception(sentry, test_app, event_loop, cancelled_future,
queue):
"""Test capture_exception."""
@asyncio.coroutine
def callback(app, message):
async def callback(app, message):
try:
1 / 0
except:
yield from sentry.capture_exception()
await sentry.capture_exception()
test_app.callback = callback

event_loop.run_until_complete(
Expand All @@ -25,9 +22,8 @@ def callback(app, message):
def test_capture_message(sentry, test_app, event_loop, cancelled_future,
queue):
"""Test capture_message."""
@asyncio.coroutine
def callback(app, message):
yield from sentry.capture_message(message)
async def callback(app, message):
await sentry.capture_message(message)
test_app.callback = callback

event_loop.run_until_complete(
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[tox]
envlist = docs,pep8,py34,py35
envlist = docs,pep8,py38,py39

[testenv]
deps =
coverage
pytest
pytest-asyncio
commands =
python -m coverage run -m pytest --strict {posargs: tests}
python -m coverage run -m pytest --strict-markers {posargs: tests}
python -m coverage report -m --include="henson_sentry.py"

[testenv:docs]
basepython = python3.5
basepython = python3.9
deps = -rdocs-requirements.txt
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees docs docs/_build/html
doc8 --allow-long-titles README.rst docs/ --ignore-path docs/_build/

[testenv:pep8]
basepython = python3.5
basepython = python3.9
skip_install = True
deps =
flake8-docstrings
Expand Down

0 comments on commit d9f3474

Please sign in to comment.