From 715292c1e5b7a88bfdc01c746f446f9ab4e0b907 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 13 Feb 2021 23:52:06 +0100 Subject: [PATCH] python3Packages.asyncwhois: enable tests --- .../python-modules/asyncwhois/default.nix | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/asyncwhois/default.nix b/pkgs/development/python-modules/asyncwhois/default.nix index 53f9f7e8f942..5c42e53fde04 100644 --- a/pkgs/development/python-modules/asyncwhois/default.nix +++ b/pkgs/development/python-modules/asyncwhois/default.nix @@ -1,20 +1,23 @@ { lib -, buildPythonPackage -, fetchPypi -, pythonOlder , aiodns -, tldextract +, asynctest +, buildPythonPackage +, fetchFromGitHub , pytestCheckHook +, pythonOlder +, tldextract }: buildPythonPackage rec { pname = "asyncwhois"; version = "0.2.4"; - disabled = pythonOlder "3.6"; + disabled = pythonOlder "3.7"; - src = fetchPypi { - inherit pname version; - sha256 = "84677e90bc2d2975788e905ae9841bc91a732a452bc870991105b0a6cc3cd22f"; + src = fetchFromGitHub { + owner = "pogzyb"; + repo = pname; + rev = "v${version}"; + sha256 = "17w007hjnpggj6jvkv8wxwllxk6mir1q2nhw0dqg7glm4lfbx8kr"; }; propagatedBuildInputs = [ @@ -22,9 +25,24 @@ buildPythonPackage rec { tldextract ]; - # tests are only present at GitHub but not the released source tarballs - # https://github.com/pogzyb/asyncwhois/issues/10 - doCheck = false; + checkInputs = [ + asynctest + pytestCheckHook + ]; + + # Disable tests that require network access + disabledTests = [ + "test_pywhois_aio_get_hostname_from_ip" + "test_pywhois_get_hostname_from_ip" + "test_pywhois_aio_lookup_ipv4" + "test_not_found" + "test_aio_from_whois_cmd" + "test_aio_get_hostname_from_ip" + "test_from_whois_cmd" + "test_get_hostname_from_ip" + "test_whois_query_run" + ]; + pythonImportsCheck = [ "asyncwhois" ]; meta = with lib; {