1{ stdenv, buildPythonPackage, fetchFromGitHub, python
2, pythonOlder, pythonAtLeast, enum34
3, doCheck ? true, pytest, pytest_xdist, flake8, flaky
4}:
5buildPythonPackage rec {
6 # http://hypothesis.readthedocs.org/en/latest/packaging.html
7
8 # Hypothesis has optional dependencies on the following libraries
9 # pytz fake_factory django numpy pytest
10 # If you need these, you can just add them to your environment.
11
12 version = "3.11.1";
13 pname = "hypothesis";
14 name = "${pname}-${version}";
15
16 # Upstream prefers github tarballs
17 src = fetchFromGitHub {
18 owner = "HypothesisWorks";
19 repo = "hypothesis-python";
20 rev = "${version}";
21 sha256 = "0damf6zbm0db2a3gfwrbbj92yal576wpmhhchc0w0np8vdnax70n";
22 };
23
24 checkInputs = stdenv.lib.optionals doCheck [ pytest pytest_xdist flake8 flaky ];
25 propagatedBuildInputs = stdenv.lib.optionals (pythonOlder "3.4") [ enum34 ];
26
27 inherit doCheck;
28
29 # https://github.com/DRMacIver/hypothesis/issues/300
30 checkPhase = ''
31 rm tox.ini # This file changes how py.test runs and breaks it
32 py.test tests/cover
33 '';
34
35 # Unsupport by upstream on certain versions
36 # https://github.com/HypothesisWorks/hypothesis-python/issues/477
37 disabled = pythonOlder "3.4" && pythonAtLeast "2.8";
38
39 meta = with stdenv.lib; {
40 description = "A Python library for property based testing";
41 homepage = https://github.com/DRMacIver/hypothesis;
42 license = licenses.mpl20;
43 };
44}