From f939f827a113d9b842486a029b08c85c0f09792a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= Date: Tue, 4 Jul 2023 09:20:35 +0200 Subject: [PATCH] Adjust tests for taskName attribute added in Python 3.12 --- tests/tests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tests.py b/tests/tests.py index 9f433d0..fc907d6 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -45,7 +45,7 @@ class TestJsonLogger(unittest.TestCase): def testPercentageFormat(self): fr = jsonlogger.JsonFormatter( # All kind of different styles to check the regex - '[%(levelname)8s] %(message)s %(filename)s:%(lineno)d %(asctime)' + '[%(levelname)8s] %(message)s %(filename)s:%(lineno)d %(asctime) %(taskName)' ) self.logHandler.setFormatter(fr) @@ -54,7 +54,7 @@ class TestJsonLogger(unittest.TestCase): logJson = json.loads(self.buffer.getvalue()) self.assertEqual(logJson["message"], msg) - self.assertEqual(logJson.keys(), {'levelname', 'message', 'filename', 'lineno', 'asctime'}) + self.assertEqual(logJson.keys(), {'levelname', 'message', 'filename', 'lineno', 'asctime', 'taskName'}) def testRenameBaseField(self): fr = jsonlogger.JsonFormatter(rename_fields={'message': '@message'}) @@ -256,7 +256,7 @@ class TestJsonLogger(unittest.TestCase): self.logger.info(" message", extra=value) msg = self.buffer.getvalue() - self.assertEqual(msg, "{\"message\": \" message\", \"special\": [3.0, 8.0]}\n") + self.assertEqual(msg, "{\"message\": \" message\", \"taskName\": null, \"special\": [3.0, 8.0]}\n") if __name__ == '__main__': if len(sys.argv[1:]) > 0: -- 2.40.1