2021-02-14 03:07:19 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
2023-04-06 14:58:04 +00:00
|
|
|
, isPyPy
|
2021-02-14 03:07:19 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, attrs
|
2022-07-14 22:14:50 +00:00
|
|
|
, exceptiongroup
|
2021-02-14 03:07:19 +00:00
|
|
|
, pexpect
|
|
|
|
, doCheck ? true
|
|
|
|
, pytestCheckHook
|
|
|
|
, pytest-xdist
|
2023-05-22 16:18:32 +00:00
|
|
|
, python
|
2020-05-09 09:55:46 +00:00
|
|
|
, sortedcontainers
|
2023-05-22 16:18:32 +00:00
|
|
|
, stdenv
|
2022-01-15 17:22:17 +00:00
|
|
|
, pythonOlder
|
2023-01-06 02:35:51 +00:00
|
|
|
, sphinxHook
|
|
|
|
, sphinx-rtd-theme
|
|
|
|
, sphinx-hoverxref
|
|
|
|
, sphinx-codeautolink
|
2023-04-06 14:58:04 +00:00
|
|
|
, tzdata
|
2017-01-30 20:15:56 +00:00
|
|
|
}:
|
|
|
|
|
2022-05-11 21:14:20 +00:00
|
|
|
buildPythonPackage rec {
|
2017-05-27 09:25:35 +00:00
|
|
|
pname = "hypothesis";
|
2023-02-26 19:03:26 +00:00
|
|
|
version = "6.68.2";
|
2023-05-22 16:18:32 +00:00
|
|
|
outputs = [ "out" ];
|
2022-01-15 17:22:17 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2017-01-30 20:15:56 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "HypothesisWorks";
|
2022-05-11 21:14:20 +00:00
|
|
|
repo = "hypothesis";
|
2018-07-19 16:36:05 +00:00
|
|
|
rev = "hypothesis-python-${version}";
|
2023-02-26 19:03:26 +00:00
|
|
|
hash = "sha256-SgX8esTyC3ulFIv9mZJUoBA5hiv7Izr2hyD+NOudkpE=";
|
2018-02-12 10:02:07 +00:00
|
|
|
};
|
2017-01-30 20:15:56 +00:00
|
|
|
|
2023-01-06 02:35:51 +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
|
|
|
|
'';
|
|
|
|
|
2018-07-19 16:36:05 +00:00
|
|
|
postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
|
|
|
|
|
2020-05-09 09:55:46 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
attrs
|
|
|
|
sortedcontainers
|
2022-07-14 22:14:50 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.11") [
|
|
|
|
exceptiongroup
|
2021-02-14 03:07:19 +00:00
|
|
|
];
|
|
|
|
|
2023-01-21 12:00:00 +00:00
|
|
|
nativeCheckInputs = [
|
2022-01-15 17:22:17 +00:00
|
|
|
pexpect
|
|
|
|
pytest-xdist
|
|
|
|
pytestCheckHook
|
2023-05-22 16:18:32 +00:00
|
|
|
] ++ lib.optionals isPyPy [
|
2023-04-06 14:58:04 +00:00
|
|
|
tzdata
|
2022-01-15 17:22:17 +00:00
|
|
|
];
|
2017-01-30 20:15:56 +00:00
|
|
|
|
|
|
|
inherit doCheck;
|
|
|
|
|
2021-02-14 03:07:19 +00:00
|
|
|
# This file changes how pytest runs and breaks it
|
|
|
|
preCheck = ''
|
|
|
|
rm tox.ini
|
2017-01-30 20:15:56 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-15 17:22:17 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/cover"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"hypothesis"
|
|
|
|
];
|
2021-02-14 03:07:19 +00:00
|
|
|
|
2023-05-22 16:18:32 +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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-12 10:02:07 +00:00
|
|
|
meta = with lib; {
|
2022-01-15 17:22:17 +00:00
|
|
|
description = "Library for property based testing";
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/HypothesisWorks/hypothesis";
|
2023-02-26 19:03:26 +00:00
|
|
|
changelog = "https://hypothesis.readthedocs.io/en/latest/changes.html#v${lib.replaceStrings [ "." ] [ "-" ] version}";
|
2017-01-30 20:15:56 +00:00
|
|
|
license = licenses.mpl20;
|
2023-07-23 17:30:22 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2017-01-30 20:15:56 +00:00
|
|
|
};
|
|
|
|
}
|