From e4991196ab694aed9dade2b8852d6895bb9015b3 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Wed, 8 May 2024 01:44:11 +0200 Subject: [PATCH] python312Packages.json-logging: fix tests on python312, small cleanup --- .../python-modules/json-logging/default.nix | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/json-logging/default.nix b/pkgs/development/python-modules/json-logging/default.nix index 3d22f4e878ba..f904d6d44ac9 100644 --- a/pkgs/development/python-modules/json-logging/default.nix +++ b/pkgs/development/python-modules/json-logging/default.nix @@ -6,17 +6,18 @@ , httpx , pytestCheckHook , pythonOlder +, pythonAtLeast , quart , requests , sanic +, setuptools , uvicorn -, wheel }: buildPythonPackage rec { pname = "json-logging"; version = "1.5.0-rc0"; - format = "setuptools"; + pyproject = true; disabled = pythonOlder "3.7"; @@ -27,16 +28,28 @@ buildPythonPackage rec { hash = "sha256-WOAEY1pONH+Gx1b8zHZDMNgJJSn7jvMO60LYTA8z/dE="; }; - nativeCheckInputs = [ + # The logging module introduced the `taskName` field in Python 3.12, which the tests don't expect + postPatch = lib.optionalString (pythonAtLeast "3.12") '' + substituteInPlace tests/helpers/constants.py \ + --replace-fail '"written_at",' '"taskName", "written_at",' + ''; + + build-system = [ + setuptools + ]; + + dependencies = [ fastapi flask httpx - pytestCheckHook quart requests sanic uvicorn - wheel + ]; + + nativeCheckInputs = [ + pytestCheckHook ]; pythonImportsCheck = [