dev-python/python-json-logger: Enable py3.13

Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Michał Górny 2024-07-12 10:35:50 +02:00
parent 14cc154007
commit 79b039b0de
No known key found for this signature in database
GPG Key ID: 639ADAE2329E240E
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,25 @@
diff --git a/tests/test_jsonlogger.py b/tests/test_jsonlogger.py
index af369d2..068e760 100644
--- a/tests/test_jsonlogger.py
+++ b/tests/test_jsonlogger.py
@@ -176,13 +176,17 @@ def test_json_default_encoder(self):
"1900-01-01T00:00:00")
@unittest.mock.patch('time.time', return_value=1500000000.0)
- def test_json_default_encoder_with_timestamp(self, time_mock):
+ @unittest.mock.patch('time.time_ns', return_value=1500000000000000000)
+ def test_json_default_encoder_with_timestamp(self, time_ns_mock, time_mock):
fr = jsonlogger.JsonFormatter(timestamp=True)
self.log_handler.setFormatter(fr)
self.log.info("Hello")
-
- self.assertTrue(time_mock.called)
+
+ if sys.version_info < (3, 13):
+ self.assertTrue(time_mock.called)
+ else:
+ self.assertTrue(time_ns_mock.called)
log_json = json.loads(self.buffer.getvalue())
self.assertEqual(log_json.get("timestamp"), "2017-07-14T02:40:00+00:00")

View File

@ -5,7 +5,7 @@ EAPI=8
DISTUTILS_USE_PEP517=setuptools
PYPI_NO_NORMALIZE=1
PYTHON_COMPAT=( python3_{10..12} pypy3 )
PYTHON_COMPAT=( python3_{10..13} pypy3 )
inherit distutils-r1 pypi
@ -24,6 +24,8 @@ distutils_enable_tests pytest
PATCHES=(
# https://github.com/madzak/python-json-logger/pull/188
"${FILESDIR}/${P}-py312.patch"
# https://github.com/madzak/python-json-logger/pull/192
"${FILESDIR}/${P}-py313.patch"
)
python_test() {