From 5a6793c4f8d9e582d8ccfca7380838c5870a0f78 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 8 Apr 2022 20:27:03 +0200 Subject: [PATCH] python3Packages.junos-eznc: fix build and tests --- .../python-modules/junos-eznc/default.nix | 66 ++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/pkgs/development/python-modules/junos-eznc/default.nix b/pkgs/development/python-modules/junos-eznc/default.nix index 426b990ccac5..d693c73130be 100644 --- a/pkgs/development/python-modules/junos-eznc/default.nix +++ b/pkgs/development/python-modules/junos-eznc/default.nix @@ -1,43 +1,77 @@ { lib , buildPythonPackage -, fetchPypi -, six -, scp -, pyserial -, paramiko -, netaddr -, ncclient -, ntc-templates -, lxml +, fetchpatch +, fetchFromGitHub + +# propagates , jinja2 +, lxml +, ncclient +, netaddr +, ntc-templates +, paramiko +, pyparsing +, pyserial , pyyaml +, scp +, six , transitions , yamlordereddictloader + +# tests +, mock , nose +, pytestCheckHook }: buildPythonPackage rec { pname = "junos-eznc"; version = "2.6.3"; + format = "setuptools"; - src = fetchPypi { - inherit pname version; - sha256 = "4eee93d0af203af7cee54a8f0c7bd28af683e829edf1fd68feba85d0ad737395"; + src = fetchFromGitHub { + owner = "Juniper"; + repo = "py-junos-eznc"; + rev = version; + hash = "sha256-XhQJwtS518AzSwyaWE392nfNdYe9+iYHvXxQsjJfzI8="; }; + patches = [ + (fetchpatch { + # Fixes tests with lxml>=4.8.0; remove > 2.6.3 + url = "https://github.com/Juniper/py-junos-eznc/commit/048f750bb7357b6f6b9db8ad64bea479298c74fb.patch"; + hash = "sha256-DYVj0BNPwDSbxDrzHhaq4F4kz1bliXB6Au3I63mRauc="; + }) + ]; + postPatch = '' substituteInPlace requirements.txt \ --replace "ncclient==0.6.9" "ncclient" ''; - checkInputs = [ nose ]; - propagatedBuildInputs = [ - scp six pyserial paramiko netaddr ncclient ntc-templates lxml jinja2 pyyaml transitions yamlordereddictloader + jinja2 + lxml + ncclient + netaddr + ntc-templates + paramiko + pyparsing + pyserial + pyyaml + scp + six + transitions + yamlordereddictloader + ]; + + checkInputs = [ + mock + nose ]; checkPhase = '' - nosetests -v --with-coverage --cover-package=jnpr.junos --cover-inclusive -a unit + nosetests -v -a unit --exclude=test_sw_put_ftp ''; pythonImportsCheck = [ "jnpr.junos" ];