Unverified Commit 04635513 authored by Fabian Affolter's avatar Fabian Affolter Committed by GitHub
Browse files

python3Packages.pytest-ansible: equalize

- add changelog to meta
- add format
- disable on unsupported Python releases
parent 08080cc6
Loading
Loading
Loading
Loading
+35 −10
Original line number Diff line number Diff line
@@ -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 ];
  };
}