1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
{
lib,
stdenv,
ansible-compat,
ansible-core,
buildPythonPackage,
coreutils,
fetchFromGitHub,
packaging,
pytest,
pytest-plus,
pytest-sugar,
pytest-xdist,
pytestCheckHook,
setuptools,
setuptools-scm,
}:
buildPythonPackage rec {
pname = "pytest-ansible";
version = "25.12.0";
pyproject = true;
src = fetchFromGitHub {
owner = "ansible";
repo = "pytest-ansible";
tag = "v${version}";
hash = "sha256-2mrz+DADelydnwNf3ytGa3igSTlybQdZ7kdlWfoG8Io=";
};
postPatch = ''
substituteInPlace inventory \
--replace-fail '/usr/bin/env' '${lib.getExe' coreutils "env"}'
'';
build-system = [
setuptools
setuptools-scm
];
buildInputs = [ pytest ];
dependencies = [
ansible-core
ansible-compat
packaging
pytest-plus
pytest-sugar
pytest-xdist
];
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''
export HOME=$TMPDIR
'';
enabledTestPaths = [ "tests/" ];
disabledTests = [
# pytest unrecognized arguments in test_pool.py
"test_ansible_test"
# Host unreachable in the inventory
"test_become"
# [Errno -3] Temporary failure in name resolution
"test_connection_failure_v2"
"test_connection_failure_extra_inventory_v2"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# These tests fail in the Darwin sandbox
"test_ansible_facts"
"test_func"
"test_param_override_with_marker"
];
disabledTestPaths = [
# Test want s to execute pytest in a subprocess
"tests/integration/test_molecule.py"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
# These tests fail in the Darwin sandbox
"tests/test_adhoc.py"
"tests/test_adhoc_result.py"
]
++ lib.optionals (lib.versionAtLeast ansible-core.version "2.16") [
# Test fail in the NixOS environment
"tests/test_adhoc.py"
];
pythonImportsCheck = [ "pytest_ansible" ];
meta = {
description = "Plugin for pytest to simplify calling ansible modules from tests or fixtures";
homepage = "https://github.com/jlaska/pytest-ansible";
changelog = "https://github.com/ansible-community/pytest-ansible/releases/tag/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
robsliwi
];
};
}
|