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