about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pytest-testinfra/default.nix
blob: 3f2cbf8d874ae3c871e53e6ceb5bcbb8a27ea22d (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchPypi
, pythonOlder
, setuptools-scm
, ansible-core
, paramiko
, pytestCheckHook
, pytest-xdist
, pywinrm
, salt
}:

buildPythonPackage rec {
  pname = "pytest-testinfra";
  version = "10.0.0";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-L7fQGFRYqbpmn/FNDdvsizkAxr3j+2+tmwlzdM5Kt30=";
  };

  nativeBuildInputs = [
    setuptools-scm
  ];

  nativeCheckInputs = [
    ansible-core
    paramiko
    pytestCheckHook
    pytest-xdist
    pywinrm
    salt
  ];

  # markers don't get added when docker is not available (leads to warnings):
  # https://github.com/pytest-dev/pytest-testinfra/blob/9.0.0/test/conftest.py#L223
  preCheck = ''
    export HOME=$(mktemp -d)
    sed -i '54imarkers = \
    \ttestinfra_hosts(host_selector): mark test to run on selected hosts \
    \tdestructive: mark test as destructive \
    \tskip_wsl: skip test on WSL, no systemd support' setup.cfg
  '';

  # docker is required for all disabled tests
  disabledTests = [
    # test/test_backends.py
    "test_command"
    "test_encoding"
    "test_ansible_any_error_fatal"
    "test_user_connection"
    "test_sudo"
    "test_docker_encoding"
  ] ++ lib.optionals (pythonOlder "3.11") [
    # broken because salt package only built for python 3.11
    "test_backend_importables"
  ];

  disabledTestPaths = [
    "test/test_modules.py"
  ];

  meta = with lib; {
    description = "Pytest plugin for testing your infrastructure";
    homepage = "https://github.com/pytest-dev/pytest-testinfra";
    license = licenses.asl20;
    maintainers = with maintainers; [ hulr ];
  };
}