From 04635513649fb7078a8da534ea22d085bda50d81 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 2 May 2023 16:20:53 +0200 Subject: [PATCH] python3Packages.pytest-ansible: equalize - add changelog to meta - add format - disable on unsupported Python releases --- .../python-modules/pytest-ansible/default.nix | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/pytest-ansible/default.nix b/pkgs/development/python-modules/pytest-ansible/default.nix index 999801ab8c36..f1ef205a4d8e 100644 --- a/pkgs/development/python-modules/pytest-ansible/default.nix +++ b/pkgs/development/python-modules/pytest-ansible/default.nix @@ -4,31 +4,51 @@ , ansible-core , coreutils , coverage +, pytest , pytestCheckHook +, pythonOlder }: buildPythonPackage rec { pname = "pytest-ansible"; version = "3.0.0"; + format = "pyproject"; + + disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "ansible"; repo = pname; - rev = "v${version}"; - sha256 = "sha256-kxOp7ScpIIzEbM4VQa+3ByHzkPS8pzdYq82rggF9Fpk="; + rev = "refs/tags/v${version}"; + hash = "sha256-kxOp7ScpIIzEbM4VQa+3ByHzkPS8pzdYq82rggF9Fpk="; }; postPatch = '' - substituteInPlace tests/conftest.py inventory --replace '/usr/bin/env' '${coreutils}/bin/env' + substituteInPlace tests/conftest.py inventory \ + --replace '/usr/bin/env' '${coreutils}/bin/env' ''; - nativeCheckInputs = [ pytestCheckHook coverage ]; - propagatedBuildInputs = [ ansible-core ]; + buildInputs = [ + pytest + ]; - format = "pyproject"; + propagatedBuildInputs = [ + ansible-core + ]; + + nativeCheckInputs = [ + coverage + pytestCheckHook + ]; + + preCheck = '' + export HOME=$TMPDIR + ''; + + pytestFlagsArray = [ + "tests/" + ]; - preCheck = "export HOME=$TMPDIR"; - pytestFlagsArray = [ "tests/" ]; disabledTests = [ # Host unreachable in the inventory "test_become" @@ -37,10 +57,15 @@ buildPythonPackage rec { "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 ]; + maintainers = with maintainers; [ costrouc ]; }; }