diff options
Diffstat (limited to 'pkgs/development/python-modules/aiocache/default.nix')
-rw-r--r-- | pkgs/development/python-modules/aiocache/default.nix | 87 |
1 files changed, 65 insertions, 22 deletions
diff --git a/pkgs/development/python-modules/aiocache/default.nix b/pkgs/development/python-modules/aiocache/default.nix index fd4e5f3a154a3..54a2bfb88ef78 100644 --- a/pkgs/development/python-modules/aiocache/default.nix +++ b/pkgs/development/python-modules/aiocache/default.nix @@ -1,10 +1,18 @@ -{ lib -, buildPythonPackage -, fetchFromGitHub -, msgpack -, pythonOlder -, redis -, setuptools +{ + lib, + aiohttp, + aiomcache, + buildPythonPackage, + fetchFromGitHub, + marshmallow, + msgpack, + pkgs, + pythonOlder, + pytest-asyncio, + pytest-mock, + pytestCheckHook, + redis, + setuptools, }: buildPythonPackage rec { @@ -21,31 +29,66 @@ buildPythonPackage rec { hash = "sha256-yvXDNJL8uxReaU81klVWudJwh1hmvg5GeeILcNpm/YA="; }; - nativeBuildInputs = [ - setuptools - ]; + postPatch = '' + substituteInPlace setup.cfg \ + --replace-fail "--cov=aiocache --cov=tests/ --cov-report term" "" + ''; + + build-system = [ setuptools ]; - passthru.optional-dependencies = { - redis = [ - redis - ]; - msgpack = [ - msgpack - ]; + optional-dependencies = { + redis = [ redis ]; + memcached = [ aiomcache ]; + msgpack = [ msgpack ]; }; - # aiomcache would be required but last release was in 2017 - doCheck = false; + nativeCheckInputs = [ + aiohttp + marshmallow + pytest-asyncio + pytest-mock + pytestCheckHook + ] ++ lib.flatten (lib.attrValues optional-dependencies); + + pytestFlagsArray = [ + "-W" + "ignore::DeprecationWarning" + # TypeError: object MagicMock can't be used in 'await' expression + "--deselect=tests/ut/backends/test_redis.py::TestRedisBackend::test_close" + ]; + + disabledTests = [ + # Test calls apache benchmark and fails, no usable output + "test_concurrency_error_rates" + ]; - pythonImportsCheck = [ - "aiocache" + disabledTestPaths = [ + # Benchmark and performance tests are not relevant for Nixpkgs + "tests/performance/" ]; + preCheck = '' + ${lib.getBin pkgs.redis}/bin/redis-server & + REDIS_PID=$! + + ${lib.getBin pkgs.memcached}/bin/memcached & + MEMCACHED_PID=$! + ''; + + postCheck = '' + kill $REDIS_PID + kill $MEMCACHED_PID + ''; + + __darwinAllowLocalNetworking = true; + + pythonImportsCheck = [ "aiocache" ]; + meta = with lib; { description = "Python API Rate Limit Decorator"; homepage = "https://github.com/aio-libs/aiocache"; changelog = "https://github.com/aio-libs/aiocache/releases/tag/v${version}"; - license = with licenses; [ bsd3 ]; + license = licenses.bsd3; maintainers = with maintainers; [ fab ]; }; } |