2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2023-04-29 16:46:19 +00:00
|
|
|
, isPyPy
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchFromGitHub
|
2024-01-13 08:15:51 +00:00
|
|
|
, setuptools
|
2021-03-09 03:18:52 +00:00
|
|
|
, attrs
|
2022-08-12 12:06:08 +00:00
|
|
|
, exceptiongroup
|
2021-03-09 03:18:52 +00:00
|
|
|
, pexpect
|
|
|
|
, doCheck ? true
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-xdist
|
2023-07-15 17:15:38 +00:00
|
|
|
, python
|
2020-06-02 18:00:15 +00:00
|
|
|
, sortedcontainers
|
2023-07-15 17:15:38 +00:00
|
|
|
, stdenv
|
2022-02-10 20:34:41 +00:00
|
|
|
, pythonOlder
|
2023-02-02 18:25:31 +00:00
|
|
|
, sphinxHook
|
|
|
|
, sphinx-rtd-theme
|
|
|
|
, sphinx-hoverxref
|
|
|
|
, sphinx-codeautolink
|
2023-04-29 16:46:19 +00:00
|
|
|
, tzdata
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "hypothesis";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "6.91.0";
|
|
|
|
pyproject = true;
|
2022-02-10 20:34:41 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "HypothesisWorks";
|
2022-06-26 10:26:21 +00:00
|
|
|
repo = "hypothesis";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "hypothesis-python-${version}";
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-2iBeB5pLVOunOJb6aGNQ/ZTj8HyeH+UkqvLPF3YVuLk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# I tried to package sphinx-selective-exclude, but it throws
|
|
|
|
# error about "module 'sphinx' has no attribute 'directives'".
|
|
|
|
#
|
|
|
|
# It probably has to do with monkey-patching internals of Sphinx.
|
|
|
|
# On bright side, this extension does not introduces new commands,
|
|
|
|
# only changes "::only" command, so we probably okay with stock
|
|
|
|
# implementation.
|
|
|
|
#
|
|
|
|
# I wonder how upstream of "hypothesis" builds documentation.
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e '/sphinx_selective_exclude.eager_only/ d' docs/conf.py
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
2020-06-02 18:00:15 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
|
|
|
sortedcontainers
|
2022-08-12 12:06:08 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
exceptiongroup
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-02-10 20:34:41 +00:00
|
|
|
pexpect
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
2023-07-15 17:15:38 +00:00
|
|
|
] ++ lib.optionals isPyPy [
|
2023-04-29 16:46:19 +00:00
|
|
|
tzdata
|
2022-02-10 20:34:41 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# This file changes how pytest runs and breaks it
|
|
|
|
preCheck = ''
|
|
|
|
rm tox.ini
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-02-10 20:34:41 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/cover"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"hypothesis"
|
|
|
|
];
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru = {
|
|
|
|
doc = stdenv.mkDerivation {
|
|
|
|
# Forge look and feel of multi-output derivation as best as we can.
|
|
|
|
#
|
|
|
|
# Using 'outputs = [ "doc" ];' breaks a lot of assumptions.
|
|
|
|
name = "${pname}-${version}-doc";
|
|
|
|
inherit src pname version;
|
|
|
|
|
|
|
|
postInstallSphinx = ''
|
|
|
|
mv $out/share/doc/* $out/share/doc/python$pythonVersion-$pname-$version
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
sphinxHook
|
|
|
|
sphinx-rtd-theme
|
|
|
|
sphinx-hoverxref
|
|
|
|
sphinx-codeautolink
|
|
|
|
];
|
|
|
|
|
|
|
|
inherit (python) pythonVersion;
|
|
|
|
inherit meta;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2022-02-10 20:34:41 +00:00
|
|
|
description = "Library for property based testing";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/HypothesisWorks/hypothesis";
|
2023-03-15 16:39:30 +00:00
|
|
|
changelog = "https://hypothesis.readthedocs.io/en/latest/changes.html#v${lib.replaceStrings [ "." ] [ "-" ] version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mpl20;
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|