From 927fffd8d947c2d3f1c1799017cda93c1ae7896e Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Sun, 19 Jan 2025 21:16:17 +0100 Subject: [PATCH] python3Packages.limits: 3.13.0 -> 4.0.1 https://github.com/alisaifee/limits/releases/tag/4.0.1 --- .../python-modules/limits/default.nix | 23 +-- .../limits/only-test-in-memory.patch | 144 +++++++++--------- 2 files changed, 79 insertions(+), 88 deletions(-) diff --git a/pkgs/development/python-modules/limits/default.nix b/pkgs/development/python-modules/limits/default.nix index 4c792674a9d2..9f154d3dee0f 100644 --- a/pkgs/development/python-modules/limits/default.nix +++ b/pkgs/development/python-modules/limits/default.nix @@ -6,7 +6,6 @@ deprecated, etcd3, fetchFromGitHub, - fetchpatch2, flaky, hiro, importlib-resources, @@ -16,7 +15,8 @@ pymongo, pytest-asyncio, pytest-benchmark, - pytest-lazy-fixture, + pytest-cov-stub, + pytest-lazy-fixtures, pytestCheckHook, pythonOlder, redis, @@ -26,7 +26,7 @@ buildPythonPackage rec { pname = "limits"; - version = "3.13.0"; + version = "4.0.1"; pyproject = true; disabled = pythonOlder "3.8"; @@ -41,23 +41,15 @@ buildPythonPackage rec { postFetch = '' rm "$out/limits/_version.py" ''; - hash = "sha256-y5iMx+AC52ZgGvAvThRaeKFqCGkwmukyZsJ+nzR2AFM="; + hash = "sha256-JXXjRVn3RQMqNYRYXF4LuV2DHzVF8PTeGepFkt4jDFM="; }; patches = [ - (fetchpatch2 { - name = "fix-incompatibility-with-latest-pytest-asyncio.patch"; - url = "https://github.com/alisaifee/limits/commit/f6dcdb253cd44ca8dc7380c481da1afd8b57af6b.patch"; - excludes = [ "requirements/test.txt" ]; - hash = "sha256-NwtN8WHNrwsRcIq18pRjzzGmm7XCzn6O5y+jo9Qr6iQ="; - }) - ./remove-fixed-start-from-async-tests.patch ./only-test-in-memory.patch ]; postPatch = '' substituteInPlace pytest.ini \ - --replace-fail "--cov=limits" "" \ --replace-fail "-K" "" substituteInPlace setup.py \ @@ -96,14 +88,13 @@ buildPythonPackage rec { PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python"; }; - doCheck = pythonOlder "3.12"; # SystemError in protobuf - nativeCheckInputs = [ flaky hiro pytest-asyncio pytest-benchmark - pytest-lazy-fixture + pytest-cov-stub + pytest-lazy-fixtures pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies); @@ -114,7 +105,7 @@ buildPythonPackage rec { meta = with lib; { description = "Rate limiting using various strategies and storage backends such as redis & memcached"; homepage = "https://github.com/alisaifee/limits"; - changelog = "https://github.com/alisaifee/limits/releases/tag/${version}"; + changelog = "https://github.com/alisaifee/limits/releases/tag/${src.tag}"; license = licenses.mit; maintainers = [ ]; }; diff --git a/pkgs/development/python-modules/limits/only-test-in-memory.patch b/pkgs/development/python-modules/limits/only-test-in-memory.patch index 2dbca193915e..6c1d1db59603 100644 --- a/pkgs/development/python-modules/limits/only-test-in-memory.patch +++ b/pkgs/development/python-modules/limits/only-test-in-memory.patch @@ -1,8 +1,8 @@ diff --git a/tests/aio/test_storage.py b/tests/aio/test_storage.py -index 1040d18..deecd9b 100644 +index 9817d8d..1382c89 100644 --- a/tests/aio/test_storage.py +++ b/tests/aio/test_storage.py -@@ -95,102 +95,6 @@ class TestBaseStorage: +@@ -96,102 +96,6 @@ class TestBaseStorage: "uri, args, expected_instance, fixture", [ pytest.param("async+memory://", {}, MemoryStorage, None, id="in-memory"), @@ -10,7 +10,7 @@ index 1040d18..deecd9b 100644 - "async+redis://localhost:7379", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis", - ), @@ -18,7 +18,7 @@ index 1040d18..deecd9b 100644 - "async+redis+unix:///tmp/limits.redis.sock", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_uds"), +- lf("redis_uds"), - marks=pytest.mark.redis, - id="redis-uds", - ), @@ -26,7 +26,7 @@ index 1040d18..deecd9b 100644 - "async+redis+unix://:password/tmp/limits.redis.sock", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_uds"), +- lf("redis_uds"), - marks=pytest.mark.redis, - id="redis-uds-auth", - ), @@ -34,7 +34,7 @@ index 1040d18..deecd9b 100644 - "async+memcached://localhost:22122", - {}, - MemcachedStorage, -- pytest.lazy_fixture("memcached"), +- lf("memcached"), - marks=pytest.mark.memcached, - id="memcached", - ), @@ -42,7 +42,7 @@ index 1040d18..deecd9b 100644 - "async+memcached://localhost:22122,localhost:22123", - {}, - MemcachedStorage, -- pytest.lazy_fixture("memcached_cluster"), +- lf("memcached_cluster"), - marks=pytest.mark.memcached, - id="memcached-cluster", - ), @@ -50,7 +50,7 @@ index 1040d18..deecd9b 100644 - "async+redis+sentinel://localhost:26379", - {"service_name": "mymaster"}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), @@ -58,7 +58,7 @@ index 1040d18..deecd9b 100644 - "async+redis+sentinel://localhost:26379/mymaster", - {}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel-service-name-url", - ), @@ -66,7 +66,7 @@ index 1040d18..deecd9b 100644 - "async+redis+sentinel://:sekret@localhost:36379/mymaster", - {"password": "sekret"}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel_auth"), +- lf("redis_sentinel_auth"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel-auth", - ), @@ -74,7 +74,7 @@ index 1040d18..deecd9b 100644 - "async+redis+cluster://localhost:7001/", - {}, - RedisClusterStorage, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), @@ -82,7 +82,7 @@ index 1040d18..deecd9b 100644 - "async+redis+cluster://:sekret@localhost:8400/", - {}, - RedisClusterStorage, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -90,7 +90,7 @@ index 1040d18..deecd9b 100644 - "async+mongodb://localhost:37017/", - {}, - MongoDBStorage, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ), @@ -98,7 +98,7 @@ index 1040d18..deecd9b 100644 - "async+etcd://localhost:2379", - {}, - EtcdStorage, -- pytest.lazy_fixture("etcd"), +- lf("etcd"), - marks=pytest.mark.etcd, - id="etcd", - ), @@ -106,10 +106,10 @@ index 1040d18..deecd9b 100644 ) class TestConcreteStorages: diff --git a/tests/test_storage.py b/tests/test_storage.py -index 1b8c7b0..97dcee5 100644 +index c3961e7..4250dbf 100644 --- a/tests/test_storage.py +++ b/tests/test_storage.py -@@ -100,110 +100,6 @@ class TestBaseStorage: +@@ -101,110 +101,6 @@ class TestBaseStorage: "uri, args, expected_instance, fixture", [ pytest.param("memory://", {}, MemoryStorage, None, id="in-memory"), @@ -117,7 +117,7 @@ index 1b8c7b0..97dcee5 100644 - "redis://localhost:7379", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis", - ), @@ -125,7 +125,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+unix:///tmp/limits.redis.sock", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_uds"), +- lf("redis_uds"), - marks=pytest.mark.redis, - id="redis-uds", - ), @@ -133,7 +133,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+unix://:password/tmp/limits.redis.sock", - {}, - RedisStorage, -- pytest.lazy_fixture("redis_uds"), +- lf("redis_uds"), - marks=pytest.mark.redis, - id="redis-uds-auth", - ), @@ -141,7 +141,7 @@ index 1b8c7b0..97dcee5 100644 - "memcached://localhost:22122", - {}, - MemcachedStorage, -- pytest.lazy_fixture("memcached"), +- lf("memcached"), - marks=pytest.mark.memcached, - id="memcached", - ), @@ -149,7 +149,7 @@ index 1b8c7b0..97dcee5 100644 - "memcached://localhost:22122,localhost:22123", - {}, - MemcachedStorage, -- pytest.lazy_fixture("memcached_cluster"), +- lf("memcached_cluster"), - marks=pytest.mark.memcached, - id="memcached-cluster", - ), @@ -157,7 +157,7 @@ index 1b8c7b0..97dcee5 100644 - "memcached:///tmp/limits.memcached.sock", - {}, - MemcachedStorage, -- pytest.lazy_fixture("memcached_uds"), +- lf("memcached_uds"), - marks=pytest.mark.memcached, - id="memcached-uds", - ), @@ -165,7 +165,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+sentinel://localhost:26379", - {"service_name": "mymaster"}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), @@ -173,7 +173,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+sentinel://localhost:26379/mymaster", - {}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel-service-name-url", - ), @@ -181,7 +181,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+sentinel://:sekret@localhost:36379/mymaster", - {"password": "sekret"}, - RedisSentinelStorage, -- pytest.lazy_fixture("redis_sentinel_auth"), +- lf("redis_sentinel_auth"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel-auth", - ), @@ -189,7 +189,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+cluster://localhost:7001/", - {}, - RedisClusterStorage, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), @@ -197,7 +197,7 @@ index 1b8c7b0..97dcee5 100644 - "redis+cluster://:sekret@localhost:8400/", - {}, - RedisClusterStorage, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -205,7 +205,7 @@ index 1b8c7b0..97dcee5 100644 - "mongodb://localhost:37017/", - {}, - MongoDBStorage, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ), @@ -213,7 +213,7 @@ index 1b8c7b0..97dcee5 100644 - "etcd://localhost:2379", - {}, - EtcdStorage, -- pytest.lazy_fixture("etcd"), +- lf("etcd"), - marks=pytest.mark.etcd, - id="etcd", - ), @@ -221,45 +221,45 @@ index 1b8c7b0..97dcee5 100644 ) class TestConcreteStorages: diff --git a/tests/utils.py b/tests/utils.py -index 558d766..9dcb911 100644 +index b8350b7..be9167b 100644 --- a/tests/utils.py +++ b/tests/utils.py -@@ -52,75 +52,6 @@ all_storage = pytest.mark.parametrize( +@@ -66,75 +66,6 @@ all_storage = pytest.mark.parametrize( "uri, args, fixture", [ - pytest.param("memory://", {}, None, id="in-memory"), + pytest.param("memory://", {}, None, marks=pytest.mark.memory, id="in-memory"), - pytest.param( - "redis://localhost:7379", - {}, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis_basic", - ), - pytest.param( - "memcached://localhost:22122", - {}, -- pytest.lazy_fixture("memcached"), +- lf("memcached"), - marks=[pytest.mark.memcached, pytest.mark.flaky], - id="memcached", - ), - pytest.param( - "memcached://localhost:22122,localhost:22123", - {}, -- pytest.lazy_fixture("memcached_cluster"), +- lf("memcached_cluster"), - marks=[pytest.mark.memcached, pytest.mark.flaky], - id="memcached-cluster", - ), - pytest.param( - "redis+cluster://localhost:7001/", - {}, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), - pytest.param( - "redis+cluster://:sekret@localhost:8400/", - {}, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -272,56 +272,56 @@ index 558d766..9dcb911 100644 - "ssl_certfile": "./tests/tls/client.crt", - "ssl_ca_certs": "./tests/tls/ca.crt", - }, -- pytest.lazy_fixture("redis_ssl_cluster"), +- lf("redis_ssl_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-ssl-cluster", - ), - pytest.param( - "redis+sentinel://localhost:26379/mymaster", - {"use_replicas": False}, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), - pytest.param( - "mongodb://localhost:37017/", - {}, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ), - pytest.param( - "etcd://localhost:2379", - {}, -- pytest.lazy_fixture("etcd"), +- lf("etcd"), - marks=[pytest.mark.etcd, pytest.mark.flaky], - id="etcd", - ), ], ) -@@ -128,54 +59,6 @@ moving_window_storage = pytest.mark.parametrize( +@@ -142,54 +73,6 @@ moving_window_storage = pytest.mark.parametrize( "uri, args, fixture", [ - pytest.param("memory://", {}, None, id="in-memory"), + pytest.param("memory://", {}, None, marks=pytest.mark.memory, id="in-memory"), - pytest.param( - "redis://localhost:7379", - {}, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis", - ), - pytest.param( - "redis+cluster://localhost:7001/", - {}, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), - pytest.param( - "redis+cluster://:sekret@localhost:8400/", - {}, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -334,63 +334,63 @@ index 558d766..9dcb911 100644 - "ssl_certfile": "./tests/tls/client.crt", - "ssl_ca_certs": "./tests/tls/ca.crt", - }, -- pytest.lazy_fixture("redis_ssl_cluster"), +- lf("redis_ssl_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-ssl-cluster", - ), - pytest.param( - "redis+sentinel://localhost:26379/mymaster", - {"use_replicas": False}, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), - pytest.param( - "mongodb://localhost:37017/", - {}, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ), ], ) -@@ -183,75 +66,6 @@ async_all_storage = pytest.mark.parametrize( - "uri, args, fixture", - [ - pytest.param("async+memory://", {}, None, id="in-memory"), +@@ -199,75 +82,6 @@ async_all_storage = pytest.mark.parametrize( + pytest.param( + "async+memory://", {}, None, marks=pytest.mark.memory, id="in-memory" + ), - pytest.param( - "async+redis://localhost:7379", - {}, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis", - ), - pytest.param( - "async+memcached://localhost:22122", - {}, -- pytest.lazy_fixture("memcached"), +- lf("memcached"), - marks=[pytest.mark.memcached, pytest.mark.flaky], - id="memcached", - ), - pytest.param( - "async+memcached://localhost:22122,localhost:22123", - {}, -- pytest.lazy_fixture("memcached_cluster"), +- lf("memcached_cluster"), - marks=[pytest.mark.memcached, pytest.mark.flaky], - id="memcached-cluster", - ), - pytest.param( - "async+redis+cluster://localhost:7001/", - {}, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), - pytest.param( - "async+redis+cluster://:sekret@localhost:8400/", - {}, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -403,56 +403,56 @@ index 558d766..9dcb911 100644 - "ssl_certfile": "./tests/tls/client.crt", - "ssl_ca_certs": "./tests/tls/ca.crt", - }, -- pytest.lazy_fixture("redis_ssl_cluster"), +- lf("redis_ssl_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-ssl-cluster", - ), - pytest.param( - "async+redis+sentinel://localhost:26379/mymaster", - {"use_replicas": False}, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), - pytest.param( - "async+mongodb://localhost:37017/", - {}, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ), - pytest.param( - "async+etcd://localhost:2379", - {}, -- pytest.lazy_fixture("etcd"), +- lf("etcd"), - marks=[pytest.mark.etcd, pytest.mark.flaky], - id="etcd", - ), ], ) -@@ -259,53 +73,5 @@ async_moving_window_storage = pytest.mark.parametrize( - "uri, args, fixture", - [ - pytest.param("async+memory://", {}, None, id="in-memory"), +@@ -277,53 +91,5 @@ async_moving_window_storage = pytest.mark.parametrize( + pytest.param( + "async+memory://", {}, None, marks=pytest.mark.memory, id="in-memory" + ), - pytest.param( - "async+redis://localhost:7379", - {}, -- pytest.lazy_fixture("redis_basic"), +- lf("redis_basic"), - marks=pytest.mark.redis, - id="redis", - ), - pytest.param( - "async+redis+cluster://localhost:7001/", - {}, -- pytest.lazy_fixture("redis_cluster"), +- lf("redis_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster", - ), - pytest.param( - "async+redis+cluster://:sekret@localhost:8400/", - {}, -- pytest.lazy_fixture("redis_auth_cluster"), +- lf("redis_auth_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-cluster-auth", - ), @@ -465,21 +465,21 @@ index 558d766..9dcb911 100644 - "ssl_certfile": "./tests/tls/client.crt", - "ssl_ca_certs": "./tests/tls/ca.crt", - }, -- pytest.lazy_fixture("redis_ssl_cluster"), +- lf("redis_ssl_cluster"), - marks=pytest.mark.redis_cluster, - id="redis-ssl-cluster", - ), - pytest.param( - "async+redis+sentinel://localhost:26379/mymaster", - {"use_replicas": False}, -- pytest.lazy_fixture("redis_sentinel"), +- lf("redis_sentinel"), - marks=pytest.mark.redis_sentinel, - id="redis-sentinel", - ), - pytest.param( - "async+mongodb://localhost:37017/", - {}, -- pytest.lazy_fixture("mongodb"), +- lf("mongodb"), - marks=pytest.mark.mongodb, - id="mongodb", - ),