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