Skip to content

Commit

Permalink
Fix tests failing on ujson v5.9 and python v3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
marselester committed Jan 6, 2024
1 parent 6d054cb commit 07979ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
-e .

tox==2.9.1
tox==4.11.4
11 changes: 5 additions & 6 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def test_message_and_time_are_in_json_record_when_extra_is_blank(self):
'message',
'time',
])
self.assertEqual(set(json_record), expected_fields)
self.assertTrue(expected_fields.issubset(json_record))

def test_message_and_time_and_extra_are_in_json_record_when_extra_is_provided(self):
logger.info('Sign up', extra={'fizz': 'bazz'})
Expand All @@ -68,7 +68,7 @@ def test_message_and_time_and_extra_are_in_json_record_when_extra_is_provided(se
'time',
'fizz',
])
self.assertEqual(set(json_record), expected_fields)
self.assertTrue(expected_fields.issubset(json_record))

def test_exc_info_is_logged(self):
try:
Expand Down Expand Up @@ -210,10 +210,9 @@ def test_django_wsgi_request_is_serialized_as_empty_list(self):
'request': request
})
json_record = json.loads(log_buffer.getvalue())
if 'status_code' in json_record:
self.assertEqual(json_record['status_code'], 500)
if 'request' in json_record:
self.assertEqual(json_record['request'], [])
self.assertEqual(json_record['status_code'], 500)
self.assertEqual(json_record['request']['path'], '/bogus')
self.assertEqual(json_record['request']['method'], 'BOGUS')

def test_json_circular_reference_is_handled(self):
d = {}
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[tox]
envlist=py27,py35,py36,py37,py38,py39,py310
envlist=py35,py36,py37,py38,py39,py310,py311,py312

[testenv]
deps=
pytest
ujson
simplejson
ujson==5.9.0
simplejson==3.19.2
django
commands=
pytest -s tests.py

0 comments on commit 07979ad

Please sign in to comment.