From 6b0c614bad5fcd59ea2997a24a596f45a824fed3 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 8 Mar 2026 21:21:34 +0000 Subject: [PATCH] python3Packages.pytest-ansible: cleanup, skip failing tests --- .../python-modules/pytest-ansible/default.nix | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/pkgs/development/python-modules/pytest-ansible/default.nix b/pkgs/development/python-modules/pytest-ansible/default.nix index c404455f3e89..0429cc996048 100644 --- a/pkgs/development/python-modules/pytest-ansible/default.nix +++ b/pkgs/development/python-modules/pytest-ansible/default.nix @@ -1,20 +1,29 @@ { lib, stdenv, - ansible-compat, - ansible-core, buildPythonPackage, - coreutils, fetchFromGitHub, - packaging, - pytest, - pytest-xdist, - pytestCheckHook, + coreutils, + + # build-system setuptools, setuptools-scm, + + # dependencies + ansible-compat, + ansible-core, + packaging, + pytest-xdist, + + # buildInputs + pytest, + + # tests + pytestCheckHook, + writableTmpDirAsHomeHook, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "pytest-ansible"; version = "26.2.0"; pyproject = true; @@ -22,7 +31,7 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "ansible"; repo = "pytest-ansible"; - tag = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-3pppBAgAfkwJNPRsI6CH4UDMqyZ45+mFNejlQwX5bCg="; }; @@ -45,11 +54,10 @@ buildPythonPackage rec { pytest-xdist ]; - nativeCheckInputs = [ pytestCheckHook ]; - - preCheck = '' - export HOME=$TMPDIR - ''; + nativeCheckInputs = [ + pytestCheckHook + writableTmpDirAsHomeHook + ]; enabledTestPaths = [ "tests/" ]; @@ -72,6 +80,14 @@ buildPythonPackage rec { disabledTestPaths = [ # Test want s to execute pytest in a subprocess "tests/integration/test_molecule.py" + + # TypeError: Cannot define type '_AnsibleLazyTemplateDict' since '_AnsibleLazyTemplateDict' + # already extends '_AnsibleTaggedDict'. + "tests/test_host_manager.py" + + # assert == + "tests/test_fixtures.py" + "tests/test_params.py" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # These tests fail in the Darwin sandbox @@ -88,10 +104,10 @@ buildPythonPackage rec { meta = { description = "Plugin for pytest 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/${src.tag}"; + changelog = "https://github.com/ansible-community/pytest-ansible/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ robsliwi ]; }; -} +})