Unverified Commit 637ce3a3 authored by Robert Schütz's avatar Robert Schütz Committed by GitHub
Browse files

Merge pull request #324548 from GaetanLepage/pytest-examples

python311Packages.pytest-examples: 0.0.10 -> 0.0.12
parents 5c59b0dd b0df19c0
Loading
Loading
Loading
Loading
+13 −28
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
  black,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  hatchling,
  pytest,
  pytestCheckHook,
@@ -14,61 +13,47 @@

buildPythonPackage rec {
  pname = "pytest-examples";
  version = "0.0.10";
  format = "pyproject";
  version = "0.0.12";
  pyproject = true;

  disabled = pythonOlder "3.8";
  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "pydantic";
    repo = "pytest-examples";
    rev = "refs/tags/v${version}";
    hash = "sha256-jCxOGDJlFkMH9VtaaPsE5zt+p3Z/mrVzhdNSI51/nVM=";
    hash = "sha256-hTLTL3w4OEv8Pkzc/h9qDMnlhe6P+Q6XUImLVDsDKvk=";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/pydantic/pytest-examples/commit/551ba911713c2859caabc91b664723dd6bc800c5.patch";
      hash = "sha256-Y3OU4fNyLADhBQGwX2jY0gagVV2q2dcn3kJRLUyCtZI=";
    })
    (fetchpatch {
      url = "https://github.com/pydantic/pytest-examples/commit/3bef5d644fe3fdb076270833768e4c6df9148530.patch";
      hash = "sha256-pf+WKzZNqgjbJiblMMLHWk23kjg4W9nm+KBmC8rG8Lw=";
    })
  ];

  postPatch = ''
    # ruff binary is used directly, the ruff Python package is not needed
    substituteInPlace pytest_examples/lint.py \
      --replace "'ruff'" "'${ruff}/bin/ruff'"
      --replace-fail "'ruff'" "'${lib.getExe ruff}'"
  '';

  pythonRemoveDeps = [ "ruff" ];

  nativeBuildInputs = [
    hatchling
    pythonRelaxDepsHook
  ];

  build-system = [
    hatchling
  ];

  buildInputs = [ pytest ];

  propagatedBuildInputs = [ black ];
  dependencies = [ black ];

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "pytest_examples" ];

  disabledTests = [
    # Test fails with latest ruff v0.1.2
    # See https://github.com/pydantic/pytest-examples/issues/26
    "test_ruff_error"
  ];

  meta = with lib; {
  meta = {
    description = "Pytest plugin for testing examples in docstrings and markdown files";
    homepage = "https://github.com/pydantic/pytest-examples";
    changelog = "https://github.com/pydantic/pytest-examples/releases/tag/v${version}";
    license = licenses.mit;
    maintainers = with maintainers; [ fab ];
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
}