From a14a3f1e3c66e93b9403d3fd9dd38b099e1574db Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 16 Feb 2022 10:06:32 +0100 Subject: [PATCH] python3Packages.limits: enable tests --- .../python-modules/limits/default.nix | 62 ++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/limits/default.nix b/pkgs/development/python-modules/limits/default.nix index 7cb622df047e..ba31679ebac3 100644 --- a/pkgs/development/python-modules/limits/default.nix +++ b/pkgs/development/python-modules/limits/default.nix @@ -1,21 +1,69 @@ -{ lib, fetchPypi, buildPythonPackage, six }: +{ lib +, buildPythonPackage +, fetchFromGitHub +, hiro +, pymemcache +, pymongo +, pytest-asyncio +, pytest-lazy-fixture +, pytestCheckHook +, pythonOlder +, redis +, setuptools +}: buildPythonPackage rec { pname = "limits"; version = "2.4.0"; + format = "setuptools"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-jiK2PfJjECB6d7db1HRZnwpGE6fZFjZQ7TpCjpzHrjU="; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "alisaifee"; + repo = pname; + rev = version; + hash = "sha256-KSYcIdLQ6TZpimxXyV88/V35GbBJ/9k9+UBM2KTMRR4="; }; - propagatedBuildInputs = [ six ]; + propagatedBuildInputs = [ + setuptools + redis + pymemcache + pymongo + ]; - doCheck = false; # ifilter + checkInputs = [ + hiro + pytest-asyncio + pytest-lazy-fixture + pytestCheckHook + ]; + + postPatch = '' + substituteInPlace pytest.ini \ + --replace "--cov=limits" "" \ + --replace "-K" "" + # redis-py-cluster doesn't support redis > 4 + substituteInPlace tests/conftest.py \ + --replace "import rediscluster" "" + ''; + + pythonImportsCheck = [ + "limits" + ]; + + pytestFlagsArray = [ + # All other tests require a running Docker instance + "tests/test_limits.py" + "tests/test_ratelimit_parser.py" + "tests/test_limit_granularities.py" + ]; meta = with lib; { description = "Rate limiting utilities"; - license = licenses.mit; homepage = "https://limits.readthedocs.org/"; + license = licenses.mit; + maintainers = with maintainers; [ ]; }; }