summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pytest-examples
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2023-07-02 16:08:42 +0200
committerFabian Affolter <mail@fabian-affolter.ch>2023-07-02 16:08:42 +0200
commiteade7923a0823c7367ba2da594331e99d4a4e271 (patch)
tree7e94f54b5569bc26b09cfaf54fdea18d08aa9e54 /pkgs/development/python-modules/pytest-examples
parent9223fdbd6db97956966810b8445f066f29bb16c0 (diff)
python311Packages.pytest-examples: init at 0.0.9
Diffstat (limited to 'pkgs/development/python-modules/pytest-examples')
-rw-r--r--pkgs/development/python-modules/pytest-examples/default.nix66
1 files changed, 66 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pytest-examples/default.nix b/pkgs/development/python-modules/pytest-examples/default.nix
new file mode 100644
index 000000000000..37e7c2fe6bfe
--- /dev/null
+++ b/pkgs/development/python-modules/pytest-examples/default.nix
@@ -0,0 +1,66 @@
+{ lib
+, black
+, buildPythonPackage
+, fetchFromGitHub
+, hatchling
+, pytest
+, pytestCheckHook
+, pythonOlder
+, pythonRelaxDepsHook
+, ruff
+}:
+
+buildPythonPackage rec {
+ pname = "pytest-examples";
+ version = "0.0.9";
+ format = "pyproject";
+
+ disabled = pythonOlder "3.8";
+
+ src = fetchFromGitHub {
+ owner = "pydantic";
+ repo = "pytest-examples";
+ rev = "refs/tags/v${version}";
+ hash = "sha256-ecxSLbPnHdL60vlc7EjKmw5rATTePqJCa5QIdyxevv0=";
+ };
+
+ 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
+ ruff
+ ];
+
+ nativeCheckInputs = [
+ pytestCheckHook
+ ];
+
+ pythonImportsCheck = [
+ "pytest_examples"
+ ];
+
+ 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 ];
+ };
+}