2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2023-05-24 13:37:59 +00:00
|
|
|
, ansible-core
|
|
|
|
, coreutils
|
|
|
|
, coverage
|
2020-04-24 23:36:52 +00:00
|
|
|
, pytest
|
2023-05-24 13:37:59 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest-ansible";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "3.1.5";
|
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.9";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ansible";
|
2023-05-24 13:37:59 +00:00
|
|
|
repo = pname;
|
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-stsgVJseZ02C7nG0Hm0wfAnhoLpM3qRZ2Lkr1N5hODw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace tests/conftest.py inventory \
|
|
|
|
--replace '/usr/bin/env' '${coreutils}/bin/env'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
buildInputs = [
|
|
|
|
pytest
|
|
|
|
];
|
2021-04-05 15:23:46 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
ansible-core
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
coverage
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMPDIR
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# Host unreachable in the inventory
|
|
|
|
"test_become"
|
|
|
|
# [Errno -3] Temporary failure in name resolution
|
|
|
|
"test_connection_failure_v2"
|
|
|
|
"test_connection_failure_extra_inventory_v2"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pytest_ansible"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Plugin for py.test to simplify calling ansible modules from tests or fixtures";
|
2023-05-24 13:37:59 +00:00
|
|
|
homepage = "https://github.com/jlaska/pytest-ansible";
|
|
|
|
changelog = "https://github.com/ansible-community/pytest-ansible/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2023-05-24 13:37:59 +00:00
|
|
|
maintainers = with maintainers; [ costrouc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|