Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at r-updates 120 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 7 # build-system 8 setuptools, 9 setuptools-scm, 10 11 # dependencies 12 packaging, 13 pexpect, 14 python-daemon, 15 pyyaml, 16 pythonOlder, 17 importlib-metadata, 18 19 # tests 20 ansible-core, 21 glibcLocales, 22 mock, 23 openssh, 24 pytest-mock, 25 pytest-timeout, 26 pytest-xdist, 27 pytestCheckHook, 28 versionCheckHook, 29}: 30 31buildPythonPackage rec { 32 pname = "ansible-runner"; 33 version = "2.4.1"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "ansible"; 38 repo = "ansible-runner"; 39 tag = version; 40 hash = "sha256-Fyavc13TRHbslRVoBawyBgvUKhuIZsxBc7go66axE0Y="; 41 }; 42 43 postPatch = '' 44 substituteInPlace pyproject.toml \ 45 --replace-fail "setuptools>=45, <=70.0.0" setuptools \ 46 --replace-fail "setuptools-scm[toml]>=6.2, <=8.1.0" setuptools-scm 47 ''; 48 49 build-system = [ 50 setuptools 51 setuptools-scm 52 ]; 53 54 dependencies = [ 55 packaging 56 pexpect 57 python-daemon 58 pyyaml 59 ] 60 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ]; 61 62 nativeCheckInputs = [ 63 ansible-core # required to place ansible CLI onto the PATH in tests 64 glibcLocales 65 mock 66 openssh 67 pytest-mock 68 pytest-timeout 69 pytest-xdist 70 pytestCheckHook 71 versionCheckHook 72 ]; 73 versionCheckProgramArg = "--version"; 74 75 preCheck = '' 76 export HOME=$(mktemp -d) 77 export PATH="$PATH:$out/bin"; 78 # avoid coverage flags 79 rm pytest.ini 80 ''; 81 82 disabledTests = [ 83 # Tests require network access 84 "test_callback_plugin_task_args_leak" 85 "test_env_accuracy" 86 # Times out on slower hardware 87 "test_large_stdout_blob" 88 # Failed: DID NOT RAISE <class 'RuntimeError'> 89 "test_validate_pattern" 90 # Assertion error 91 "test_callback_plugin_censoring_does_not_overwrite" 92 "test_get_role_list" 93 "test_include_role_from_collection_events" 94 "test_module_level_no_log" 95 "test_resolved_actions" 96 ]; 97 98 disabledTestPaths = [ 99 # These tests unset PATH and then run executables like `bash` (see https://github.com/ansible/ansible-runner/pull/918) 100 "test/integration/test_runner.py" 101 "test/unit/test_runner.py" 102 ] 103 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 104 # Integration tests on Darwin are not regularly passing in ansible-runner's own CI 105 "test/integration" 106 # These tests write to `/tmp` which is not writable on Darwin 107 "test/unit/config/test__base.py" 108 ]; 109 110 pythonImportsCheck = [ "ansible_runner" ]; 111 112 meta = { 113 description = "Helps when interfacing with Ansible"; 114 homepage = "https://github.com/ansible/ansible-runner"; 115 changelog = "https://github.com/ansible/ansible-runner/releases/tag/${version}"; 116 license = lib.licenses.asl20; 117 maintainers = with lib.maintainers; [ GaetanLepage ]; 118 mainProgram = "ansible-runner"; 119 }; 120}