1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonAtLeast
5, setuptools-scm
6, ansible-core
7, paramiko
8, pytestCheckHook
9, pytest-xdist
10, pywinrm
11, salt
12}:
13
14buildPythonPackage rec {
15 pname = "pytest-testinfra";
16 version = "9.0.0";
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-UxGzaeBUaSD85GTDv5RbVevnWhJ1aPbWFelLiJE0AUk=";
21 };
22
23 nativeBuildInputs = [
24 setuptools-scm
25 ];
26
27 nativeCheckInputs = [
28 ansible-core
29 paramiko
30 pytestCheckHook
31 pytest-xdist
32 pywinrm
33 salt
34 ];
35
36 # markers don't get added when docker is not available (leads to warnings):
37 # https://github.com/pytest-dev/pytest-testinfra/blob/9.0.0/test/conftest.py#L223
38 preCheck = ''
39 export HOME=$(mktemp -d)
40 sed -i '54imarkers = \
41 \ttestinfra_hosts(host_selector): mark test to run on selected hosts \
42 \tdestructive: mark test as destructive \
43 \tskip_wsl: skip test on WSL, no systemd support' setup.cfg
44 '';
45
46 # docker is required for all disabled tests
47 disabledTests = [
48 # test/test_backends.py
49 "test_command"
50 "test_encoding"
51 "test_ansible_any_error_fatal"
52 "test_user_connection"
53 "test_sudo"
54 "test_docker_encoding"
55 ] ++ lib.optionals (pythonAtLeast "3.11") [
56 # broken because salt package only built for python 3.10
57 "test_backend_importables"
58 ];
59
60 disabledTestPaths = [
61 "test/test_modules.py"
62 ];
63
64 meta = with lib; {
65 description = "Pytest plugin for testing your infrastructure";
66 homepage = "https://github.com/pytest-dev/pytest-testinfra";
67 license = licenses.asl20;
68 maintainers = with maintainers; [ hulr ];
69 };
70}