diff --git a/pkgs/development/python-modules/pytest-ansible/default.nix b/pkgs/development/python-modules/pytest-ansible/default.nix index c28d46886586..f1ef205a4d8e 100644 --- a/pkgs/development/python-modules/pytest-ansible/default.nix +++ b/pkgs/development/python-modules/pytest-ansible/default.nix @@ -1,46 +1,71 @@ { lib , buildPythonPackage , fetchFromGitHub -, ansible +, ansible-core +, coreutils +, coverage , pytest -, mock +, pytestCheckHook +, pythonOlder }: buildPythonPackage rec { pname = "pytest-ansible"; - version = "2.2.4"; + version = "3.0.0"; + format = "pyproject"; + + disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "ansible"; - repo = "pytest-ansible"; - rev = "v${version}"; - sha256 = "0vr015msciwzz20zplxalfmfx5hbg8rkf8vwjdg3z12fba8z8ks4"; + repo = pname; + rev = "refs/tags/v${version}"; + hash = "sha256-kxOp7ScpIIzEbM4VQa+3ByHzkPS8pzdYq82rggF9Fpk="; }; - patchPhase = '' - sed -i "s/'setuptools-markdown'//g" setup.py + postPatch = '' + substituteInPlace tests/conftest.py inventory \ + --replace '/usr/bin/env' '${coreutils}/bin/env' ''; - buildInputs = [ pytest ]; + buildInputs = [ + pytest + ]; - # requires pandoc < 2.0 - # buildInputs = [ setuptools-markdown ]; - nativeCheckInputs = [ mock ]; - propagatedBuildInputs = [ ansible ]; + propagatedBuildInputs = [ + ansible-core + ]; - # tests not included with release, even on github - doCheck = false; + nativeCheckInputs = [ + coverage + pytestCheckHook + ]; - checkPhase = '' - HOME=$TMPDIR pytest tests/ + preCheck = '' + export HOME=$TMPDIR ''; + pytestFlagsArray = [ + "tests/" + ]; + + disabledTests = [ + # Host unreachable in the inventory + "test_become" + # [Errno -3] Temporary failure in name resolution + "test_connection_failure_v2" + "test_connection_failure_extra_inventory_v2" + ]; + + pythonImportsCheck = [ + "pytest_ansible" + ]; + meta = with lib; { - homepage = "https://github.com/jlaska/pytest-ansible"; description = "Plugin for py.test 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/v${version}"; license = licenses.mit; - maintainers = [ maintainers.costrouc ]; - # https://github.com/ansible-community/pytest-ansible/blob/v2.2.4/setup.py#L124 - broken = lib.versionAtLeast ansible.version "2.10"; + maintainers = with maintainers; [ costrouc ]; }; }