From 081d9e7fbca1c534c9dd905b0bb2b3a81081c950 Mon Sep 17 00:00:00 2001 From: Kerstin Humm Date: Thu, 4 Jul 2024 16:01:17 +0200 Subject: [PATCH] python3Packages.python-redis-locks: fix tests for withDjango = true Also remove a skipped test that just seems to work Remove maintainer, as they asked for it here: https://github.com/NixOS/nixpkgs/pull/212270#issuecomment-1400459355 --- .../python-redis-lock/default.nix | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/pkgs/development/python-modules/python-redis-lock/default.nix b/pkgs/development/python-modules/python-redis-lock/default.nix index b89a7534a2ab4..f793482a2c483 100644 --- a/pkgs/development/python-modules/python-redis-lock/default.nix +++ b/pkgs/development/python-modules/python-redis-lock/default.nix @@ -1,19 +1,19 @@ -{ - lib, - stdenv, - buildPythonPackage, - setuptools, - eventlet, - fetchPypi, - fetchpatch, - gevent, - pkgs, - process-tests, - pytestCheckHook, - pythonOlder, - redis, - withDjango ? false, - django-redis, +{ lib +, stdenv +, buildPythonPackage +, setuptools +, eventlet +, fetchPypi +, fetchpatch +, gevent +, pkgs +, process-tests +, pytestCheckHook +, pythonOlder +, redis +, withDjango ? false +, django-redis +, }: buildPythonPackage rec { @@ -30,12 +30,17 @@ buildPythonPackage rec { hash = "sha256-Sr0Lz0kTasrWZye/VIbdJJQHjKVeSe+mk/eUB3MZCRo="; }; + # Fix django tests + prePatch = lib.optionalString withDjango '' + substituteInPlace tests/test_project/settings.py \ + --replace "USE_L10N = True" "" + ''; + patches = [ (fetchpatch { url = "https://github.com/ionelmc/python-redis-lock/pull/119.diff"; hash = "sha256-Fo43+pCtnrEMxMdEEdo0YfJGkBlhhH0GjYNgpZeHF3U="; }) - ./test_signal_expiration_increase_sleep.patch ]; @@ -49,16 +54,13 @@ buildPythonPackage rec { pkgs.redis ]; - disabledTests = - [ - # https://github.com/ionelmc/python-redis-lock/issues/86 - "test_no_overlap2" - ] - ++ lib.optionals stdenv.isDarwin [ - # fail on Darwin because it defaults to multiprocessing `spawn` - "test_reset_signalizes" - "test_reset_all_signalizes" - ]; + preCheck = lib.optionalString withDjango "export DJANGO_SETTINGS_MODULE=test_project.settings"; + + disabledTests = lib.optionals stdenv.isDarwin [ + # fail on Darwin because it defaults to multiprocessing `spawn` + "test_reset_signalizes" + "test_reset_all_signalizes" + ]; pythonImportsCheck = [ "redis_lock" ]; @@ -67,6 +69,6 @@ buildPythonPackage rec { description = "Lock context manager implemented via redis SETNX/BLPOP"; homepage = "https://github.com/ionelmc/python-redis-lock"; license = licenses.bsd2; - maintainers = with maintainers; [ vanschelven ]; + maintainers = with maintainers; [ erictapen ]; }; }