Skip to content

Commit

Permalink
Running tests using python 3.12 (#81)
Browse files Browse the repository at this point in the history
* chore: update python version to support tests with 3.12
  • Loading branch information
salman2013 authored Mar 11, 2024
1 parent 9f6530b commit f303bf4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [quality, docs, pii_check, django32, django40]
python-version: ['3.8', '3.12']
toxenv: [quality, docs, pii_check, django42]

steps:
- uses: actions/checkout@v3
Expand All @@ -37,7 +37,7 @@ jobs:
run: tox

- name: Run coverage
if: matrix.python-version == '3.8' && matrix.toxenv == 'django32'
if: matrix.python-version == '3.8' && matrix.toxenv == 'django42'
uses: codecov/codecov-action@v3
with:
flags: unittests
Expand Down
2 changes: 1 addition & 1 deletion edx_event_bus_redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from edx_event_bus_redis.internal.consumer import RedisEventConsumer
from edx_event_bus_redis.internal.producer import create_producer

__version__ = '0.3.3'
__version__ = '0.4.0'

default_app_config = 'edx_event_bus_redis.apps.EdxEventBusRedisConfig' # pylint: disable=invalid-name
17 changes: 12 additions & 5 deletions edx_event_bus_redis/internal/tests/test_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Tests for message module.
"""

import re
from datetime import datetime, timezone
from uuid import UUID

Expand Down Expand Up @@ -68,14 +69,20 @@ def test_no_type(self):
)

def test_no_event_data(self):
msg = (b'1', {b'id': b'629f9892-c258-11ed-8dac-1c83413013cb', b'event_data': self.event_data_bytes})
msg = (
b'1',
{
b'id': b'629f9892-c258-11ed-8dac-1c83413013cb',
b'event_data': self.event_data_bytes,
}
)
with pytest.raises(UnusableMessageError) as excinfo:
RedisMessage.parse(msg, topic='some-local-topic')

assert excinfo.value.args == (
"Error determining metadata from message headers: "
"__init__() missing 1 required positional argument: 'event_type'",
expected_error_pattern = re.compile(
r"Error determining metadata from message headers: .*__init__\(\) "
r"missing 1 required positional argument: 'event_type'"
)
assert expected_error_pattern.search(str(excinfo.value)) is not None

def test_bad_msg(self):
"""
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ def is_requirement(line):
classifiers=[
'Development Status :: 3 - Alpha',
'Framework :: Django',
'Framework :: Django :: 3.2',
'Framework :: Django :: 4.2',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.12',
],
)
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38-django{32,40}
envlist = py{38,312}-django{42}

[pycodestyle]
exclude = .git,.tox,migrations
Expand Down Expand Up @@ -32,8 +32,8 @@ norecursedirs = .* docs requirements site-packages

[testenv]
deps =
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django42: Django>=4.2,<5.0
setuptools
-r{toxinidir}/requirements/test.txt
commands =
python manage.py check
Expand Down Expand Up @@ -64,6 +64,7 @@ allowlist_externals =
rm
touch
deps =
setuptools
-r{toxinidir}/requirements/quality.txt
commands =
touch tests/__init__.py
Expand Down

0 comments on commit f303bf4

Please sign in to comment.