python3Packages.junos-eznc: fix build and tests

This commit is contained in:
Martin Weinelt 2022-04-08 20:27:03 +02:00
parent 44f0a04ddd
commit 5a6793c4f8

View File

@ -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" ];