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