From b56d66f50710a548a248e757fb62de764998065a Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Wed, 29 Sep 2021 09:41:51 +0200 Subject: [PATCH] python3Packages.aiounifi: enable tests --- .../python-modules/aiounifi/default.nix | 42 +++++++++++++------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/aiounifi/default.nix b/pkgs/development/python-modules/aiounifi/default.nix index 14cc707b832a..e537222f4dfb 100644 --- a/pkgs/development/python-modules/aiounifi/default.nix +++ b/pkgs/development/python-modules/aiounifi/default.nix @@ -1,26 +1,44 @@ -{ lib, buildPythonPackage, fetchPypi, isPy3k -, aiohttp }: +{ lib +, aiohttp +, aioresponses +, buildPythonPackage +, fetchFromGitHub +, pytest-aiohttp +, pytest-asyncio +, pytestCheckHook +, pythonOlder +}: buildPythonPackage rec { pname = "aiounifi"; version = "27"; - disabled = ! isPy3k; + disabled = pythonOlder "3.7"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-e84EwhyHxO7KHbWFzCiXw285q2baUkE7J25tED3Yt2o="; + src = fetchFromGitHub { + owner = "Kane610"; + repo = pname; + rev = "v${version}"; + sha256 = "09bxyfrwhqwlfxwgbbnkyd7md9wz05y3fjvc9f0rrj70z7qcicnv"; }; - propagatedBuildInputs = [ aiohttp ]; + propagatedBuildInputs = [ + aiohttp + ]; - # upstream has no tests - doCheck = false; + checkInputs = [ + aioresponses + pytest-aiohttp + pytest-asyncio + pytestCheckHook + ]; + + pythonImportsCheck = [ "aiounifi" ]; meta = with lib; { - description = "An asynchronous Python library for communicating with Unifi Controller API"; - homepage = "https://pypi.python.org/pypi/aiounifi/"; - license = licenses.mit; + description = "Python library for communicating with Unifi Controller API"; + homepage = "https://github.com/Kane610/aiounifi"; + license = licenses.mit; maintainers = with maintainers; [ peterhoeg ]; }; }