From 07979adb0ca7bb666f602c0934394c6ff80b04e6 Mon Sep 17 00:00:00 2001 From: marselester Date: Sat, 6 Jan 2024 16:20:13 -0500 Subject: [PATCH] Fix tests failing on ujson v5.9 and python v3.12 --- requirements.txt | 2 +- tests.py | 11 +++++------ tox.ini | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1b32173..e78704f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -e . -tox==2.9.1 +tox==4.11.4 diff --git a/tests.py b/tests.py index 5823156..af6a9d1 100644 --- a/tests.py +++ b/tests.py @@ -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'}) @@ -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: @@ -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 = {} diff --git a/tox.ini b/tox.ini index aae28ab..289414e 100644 --- a/tox.ini +++ b/tox.ini @@ -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