2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, attrs
|
2022-08-12 12:06:08 +00:00
|
|
|
, exceptiongroup
|
2021-03-09 03:18:52 +00:00
|
|
|
, pexpect
|
|
|
|
, doCheck ? true
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-xdist
|
2020-06-02 18:00:15 +00:00
|
|
|
, sortedcontainers
|
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
|
|
|
|
# Used to break internal dependency loop.
|
|
|
|
, enableDocumentation ? true
|
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";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "6.61.0";
|
2023-02-02 18:25:31 +00:00
|
|
|
outputs = [ "out" ] ++ lib.optional enableDocumentation "doc";
|
2022-02-10 20:34:41 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
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}";
|
2023-01-20 10:41:00 +00:00
|
|
|
hash = "sha256-gTcdJaOgP8Nc4fN8UH6+sLedivq5ZNxMRULajFOVnSo=";
|
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";
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeBuildInputs = lib.optionals enableDocumentation [
|
|
|
|
sphinxHook
|
|
|
|
sphinx-rtd-theme
|
|
|
|
sphinx-hoverxref
|
|
|
|
sphinx-codeautolink
|
|
|
|
];
|
|
|
|
|
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
|
|
|
|
];
|
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
|
|
|
|
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";
|
|
|
|
license = licenses.mpl20;
|
2021-03-09 03:18:52 +00:00
|
|
|
maintainers = with maintainers; [ SuperSandro2000 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|