1{ lib
2, buildPythonPackage
3, pythonAtLeast
4, fetchFromGitHub
5, attrs
6, pexpect
7, doCheck ? true
8, pytestCheckHook
9, pytest-xdist
10, sortedcontainers
11, tzdata
12}:
13buildPythonPackage rec {
14 # https://hypothesis.readthedocs.org/en/latest/packaging.html
15
16 # Hypothesis has optional dependencies on the following libraries
17 # pytz fake_factory django numpy pytest
18 # If you need these, you can just add them to your environment.
19
20 pname = "hypothesis";
21 version = "6.24.5";
22
23 # Use github tarballs that includes tests
24 src = fetchFromGitHub {
25 owner = "HypothesisWorks";
26 repo = "hypothesis-python";
27 rev = "hypothesis-python-${version}";
28 sha256 = "+pPnMgbLdYbh0xqPewNOJRaL7VtxeN73wbHHuK0fNYo=";
29 };
30
31 postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
32
33 propagatedBuildInputs = [
34 attrs
35 sortedcontainers
36 ];
37
38 checkInputs = [ pytestCheckHook pytest-xdist pexpect ]
39 ++ lib.optional (pythonAtLeast "3.9") tzdata;
40
41 inherit doCheck;
42
43 # This file changes how pytest runs and breaks it
44 preCheck = ''
45 rm tox.ini
46 '';
47
48 pytestFlagsArray = [ "tests/cover" ];
49
50 meta = with lib; {
51 description = "A Python library for property based testing";
52 homepage = "https://github.com/HypothesisWorks/hypothesis";
53 license = licenses.mpl20;
54 maintainers = with maintainers; [ SuperSandro2000 ];
55 };
56}