python3Packages.{valkey,limits}: fix broken tests on Darwin (#422850)

This commit is contained in:
Martin Weinelt 2025-07-06 13:37:49 +02:00 committed by GitHub
commit 0cb87f17f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 19 deletions

View File

@ -27,11 +27,9 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "limits"; pname = "limits";
version = "5.2.0"; version = "5.4.0";
pyproject = true; pyproject = true;
disabled = pythonOlder "3.8";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "alisaifee"; owner = "alisaifee";
repo = "limits"; repo = "limits";
@ -39,10 +37,10 @@ buildPythonPackage rec {
# Upstream uses versioneer, which relies on git attributes substitution. # Upstream uses versioneer, which relies on git attributes substitution.
# This leads to non-reproducible archives on github. Remove the substituted # This leads to non-reproducible archives on github. Remove the substituted
# file here, and recreate it later based on our version info. # file here, and recreate it later based on our version info.
hash = "sha256-EHLqkd5Muazr52/oYaLklFVvF+AzJWGbFaaIG+T0ulE=";
postFetch = '' postFetch = ''
rm "$out/limits/_version.py" rm "$out/limits/_version.py"
''; '';
hash = "sha256-0D44XaSZtebMnn9mqXbaE7FB7usdu/eZ/4UE3Ye0oyA=";
}; };
patches = [ patches = [
@ -102,15 +100,19 @@ buildPythonPackage rec {
pytestFlagsArray = [ "--benchmark-disable" ]; pytestFlagsArray = [ "--benchmark-disable" ];
disabledTests = [ "test_moving_window_memcached" ]; disabledTests = [
"test_moving_window_memcached"
# Flaky: compares time to magic value
"test_sliding_window_counter_previous_window"
];
pythonImportsCheck = [ "limits" ]; pythonImportsCheck = [ "limits" ];
meta = with lib; { meta = {
description = "Rate limiting using various strategies and storage backends such as redis & memcached"; description = "Rate limiting using various strategies and storage backends such as redis & memcached";
homepage = "https://github.com/alisaifee/limits"; homepage = "https://github.com/alisaifee/limits";
changelog = "https://github.com/alisaifee/limits/releases/tag/${src.tag}"; changelog = "https://github.com/alisaifee/limits/releases/tag/${src.tag}";
license = licenses.mit; license = lib.licenses.mit;
maintainers = [ ]; maintainers = with lib.maintainers; [ sarahec ];
}; };
} }

View File

@ -1,5 +1,6 @@
{ {
lib, lib,
stdenv,
fetchFromGitHub, fetchFromGitHub,
buildPythonPackage, buildPythonPackage,
pythonOlder, pythonOlder,
@ -32,8 +33,6 @@ buildPythonPackage rec {
version = "6.1.0"; version = "6.1.0";
pyproject = true; pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "valkey-io"; owner = "valkey-io";
repo = "valkey-py"; repo = "valkey-py";
@ -78,19 +77,32 @@ buildPythonPackage rec {
pytestFlagsArray = [ "-m 'not onlycluster and not ssl'" ]; pytestFlagsArray = [ "-m 'not onlycluster and not ssl'" ];
disabledTests = [ disabledTests =
# valkey.sentinel.MasterNotFoundError: No master found for 'valkey-py-test' [
"test_get_from_cache" # valkey.sentinel.MasterNotFoundError: No master found for 'valkey-py-test'
"test_cache_decode_response" "test_get_from_cache"
# Expects another valkey instance on port 6380 *shrug* "test_cache_decode_response"
"test_psync" # Expects another valkey instance on port 6380 *shrug*
"test_psync"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# OSError: AF_UNIX path too long
"test_uds_connect"
"test_network_connection_failure"
];
disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
# AttributeError: Can't get local object 'TestMultiprocessing.test_valkey_client.<locals>.target'
"tests/test_multiprocessing.py"
]; ];
meta = with lib; { __darwinAllowLocalNetworking = true;
meta = {
description = "Python client for Redis key-value store"; description = "Python client for Redis key-value store";
homepage = "https://github.com/valkey-io/valkey-py"; homepage = "https://github.com/valkey-io/valkey-py";
changelog = "https://github.com/valkey-io/valkey-py/releases/tag/${src.tag}"; changelog = "https://github.com/valkey-io/valkey-py/releases/tag/${src.tag}";
license = with licenses; [ mit ]; license = lib.licenses.mit;
maintainers = with maintainers; [ hexa ]; maintainers = with lib.maintainers; [ hexa ];
}; };
} }