diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..107141f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,26 @@ +name: nameko-sentry CI build +on: [push] +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 4 + matrix: + python-version: [3.8, 3.9] + services: + rabbitmq: + image: rabbitmq:3-management + ports: + - 5672:5672 + - 15672:15672 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: "${{ matrix.python-version }}" + - name: Upgrade pip + run: pip install pip setuptools wheel --upgrade + - name: Install tox + run: pip install tox tox-gh-actions + - name: Run tox + run: python -m tox diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6b6ceb7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -sudo: false -language: python - -services: - - rabbitmq - -install: - - pip install tox - -matrix: - include: - - stage: static - python: 2.7 - env: TOX_ENV=py27-static - - stage: static - python: 3.6 - env: TOX_ENV=py36-static - - stage: test - python: 2.7 - env: TOX_ENV=py27-test - - stage: test - python: 3.4 - env: TOX_ENV=py34-test - - stage: test - python: 3.5 - env: TOX_ENV=py35-test - - stage: test - python: 3.6 - env: TOX_ENV=py36-test - - stage: deploy - script: skip - deploy: - provider: pypi - user: mattbennett - password: - secure: "E68NUiQ72jbJ6BVZWp9gsASjESwjuvWiHTprkJxI+y/1lnGBrEt4TROioUZFzSdi17sM072TJy/fiVaWtgXfWWbwWqTFGCzT57wcCFjFAw68+dM3LRL1LitHm0+PyyN47IhtbPLUrtWUc/JHV9O9bqGdHmBIQqVGbeanglMZ0p97HkCLwSQYU46hUsM2MQ1uXyPh2gKI0vhnSXIsuuYuw+61YQFmZ5WQbgEewuBlYwip1CCkiwClbspfQRWriVgbiyp4KbSbeCITPDX5OZBw1x5tB8o7aZMMKnxhP+OybFbw7PsfNIiW6YGusKldiJoLO3QCaPfbv4PE2zp1oivFjkAlbAfFjcsdFH/gnbDZK01o4RB65TB53Mg94lTq05rFH5cK5BMMuouIdnHQCDRMmY8SzGV8KmXprAhq8UGwI4HJIw0q5vWrNOoxedcBF+gaI0YMT1l70lSW+ioypF99JhdU78lWzHOGnjQsKkWriSznazNBLVvZ6mvozXtr/stHZYpiotSB1X04Cps/XXB4AVsqQjFk22uiOb8nv1jWHZxziuX28VEoebJA4K6OP8pxZnQ9/esGTx6Yqfzl4H/DxsA/qDaJa0pS9R3aT6TQ4aaKL7YPWdFJvJF8vSSijYmfW1boRlvUnuagjW+Zsv4LqKjwzbZHCfAbOR09IqeI6+E=" - on: - tags: true - repo: nameko/nameko-sentry - -script: - - tox -e $TOX_ENV diff --git a/Makefile b/Makefile index a7537ed..1917531 100644 --- a/Makefile +++ b/Makefile @@ -7,5 +7,5 @@ pylint: pylint nameko_sentry -E pytest: - coverage run --concurrency=eventlet --source nameko_sentry.py --branch -m pytest test_nameko_sentry.py + nameko test --cov -vv coverage report --show-missing --fail-under=100 diff --git a/nameko_sentry.py b/nameko_sentry.py index 18f7713..891c0e8 100644 --- a/nameko_sentry.py +++ b/nameko_sentry.py @@ -88,7 +88,7 @@ def http_context(self, worker_ctx): 'headers': dict(get_headers(request.environ)), 'env': dict(get_environ(request.environ)), }) - except: + except Exception: pass # probably not a compatible entrypoint self.client.http_context(http) diff --git a/setup.py b/setup.py index 23ceeb0..ba70dca 100644 --- a/setup.py +++ b/setup.py @@ -11,15 +11,17 @@ py_modules=['nameko_sentry'], install_requires=[ "nameko>=2.5.1", - "raven>=3.0.0" + "raven>=3.0.0", + "werkzeug<3", ], extras_require={ - 'dev': [ - "coverage==4.0.3", - "flake8==3.3.0", - "pylint==1.8.2", - "pytest==2.8.3", - "objgraph==3.1.0" + "dev": [ + "coverage==6.0.1", + "flake8==3.9.2", + "objgraph==3.5.0", + "pylint==2.11.1", + "pytest==6.0.2", + "pytest-cov==3.0.0", ] }, zip_safe=True, diff --git a/test_nameko_sentry.py b/test_nameko_sentry.py index 67b8f9e..0ddea52 100644 --- a/test_nameko_sentry.py +++ b/test_nameko_sentry.py @@ -502,7 +502,7 @@ def resource(self, request): _, kwargs = sentry.client.send.call_args received_data = kwargs['request']['data'] - assert received_data == json.dumps(submitted_data).encode('utf-8') + assert received_data == json.dumps(submitted_data) def test_form_submission( self, container_factory, config, web_session diff --git a/tox.ini b/tox.ini index 8d1aa6e..87eff78 100644 --- a/tox.ini +++ b/tox.ini @@ -1,14 +1,19 @@ [tox] -envlist = {py27,py36}-static, {py27,py34,py35,py36}-test +envlist = py39-static, py{38,39}-test skipsdist = True [testenv] -whitelist_externals = make +allowlist_externals = make commands = static: pip install --editable .[dev] static: make flake8 static: make pylint - lib: pip install --editable .[dev] - lib: make pytest + test: pip install --editable .[dev] + test: make pytest + +[gh-actions] +python = + 3.8: py38-test + 3.9: py39-test, py39-static