2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, black
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2024-04-21 15:54:59 +00:00
|
|
|
, fetchpatch
|
2023-07-15 17:15:38 +00:00
|
|
|
, hatchling
|
|
|
|
, pytest
|
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
|
|
|
, pythonRelaxDepsHook
|
|
|
|
, ruff
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest-examples";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "0.0.10";
|
2023-07-15 17:15:38 +00:00
|
|
|
format = "pyproject";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.8";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pydantic";
|
|
|
|
repo = "pytest-examples";
|
|
|
|
rev = "refs/tags/v${version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-jCxOGDJlFkMH9VtaaPsE5zt+p3Z/mrVzhdNSI51/nVM=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
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=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
postPatch = ''
|
|
|
|
# ruff binary is used directly, the ruff Python package is not needed
|
|
|
|
substituteInPlace pytest_examples/lint.py \
|
|
|
|
--replace "'ruff'" "'${ruff}/bin/ruff'"
|
|
|
|
'';
|
|
|
|
|
|
|
|
pythonRemoveDeps = [
|
|
|
|
"ruff"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
hatchling
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
pytest
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
black
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pytest_examples"
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
disabledTests = [
|
|
|
|
# Test fails with latest ruff v0.1.2
|
|
|
|
# See https://github.com/pydantic/pytest-examples/issues/26
|
|
|
|
"test_ruff_error"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
meta = with lib; {
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|