From 08080cc60075444dc4c43ab6bd50e22f50eaa2ae Mon Sep 17 00:00:00 2001 From: Et7f3 Date: Wed, 26 Apr 2023 23:39:06 +0000 Subject: [PATCH 1/2] python310Packages.pytest-ansible,python311Packages.pytest-ansible: 2.2.4 -> 3.0.0 --- .../python-modules/pytest-ansible/default.nix | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/pkgs/development/python-modules/pytest-ansible/default.nix b/pkgs/development/python-modules/pytest-ansible/default.nix index c28d46886586..999801ab8c36 100644 --- a/pkgs/development/python-modules/pytest-ansible/default.nix +++ b/pkgs/development/python-modules/pytest-ansible/default.nix @@ -1,46 +1,46 @@ { lib , buildPythonPackage , fetchFromGitHub -, ansible -, pytest -, mock +, ansible-core +, coreutils +, coverage +, pytestCheckHook }: buildPythonPackage rec { pname = "pytest-ansible"; - version = "2.2.4"; + version = "3.0.0"; src = fetchFromGitHub { owner = "ansible"; - repo = "pytest-ansible"; + repo = pname; rev = "v${version}"; - sha256 = "0vr015msciwzz20zplxalfmfx5hbg8rkf8vwjdg3z12fba8z8ks4"; + sha256 = "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 ]; + nativeCheckInputs = [ pytestCheckHook coverage ]; + propagatedBuildInputs = [ ansible-core ]; - # requires pandoc < 2.0 - # buildInputs = [ setuptools-markdown ]; - nativeCheckInputs = [ mock ]; - propagatedBuildInputs = [ ansible ]; + format = "pyproject"; - # tests not included with release, even on github - doCheck = false; - - 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" + ]; meta = with lib; { homepage = "https://github.com/jlaska/pytest-ansible"; description = "Plugin for py.test to simplify calling ansible modules from tests or fixtures"; 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"; }; } From 04635513649fb7078a8da534ea22d085bda50d81 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Tue, 2 May 2023 16:20:53 +0200 Subject: [PATCH 2/2] 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 ]; }; }