nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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, pythonOlder
13}:
14buildPythonPackage rec {
15 # https://hypothesis.readthedocs.org/en/latest/packaging.html
16
17 # Hypothesis has optional dependencies on the following libraries
18 # pytz fake_factory django numpy pytest
19 # If you need these, you can just add them to your environment.
20
21 pname = "hypothesis";
22 version = "6.40.0";
23 format = "setuptools";
24
25 disabled = pythonOlder "3.7";
26
27 src = fetchFromGitHub {
28 owner = "HypothesisWorks";
29 repo = "hypothesis-python";
30 rev = "hypothesis-python-${version}";
31 hash = "sha256-6BC3CTotkMhguueH4NJM8VjbrYhofHqtZEUytcllMwQ=";
32 };
33
34 postUnpack = "sourceRoot=$sourceRoot/hypothesis-python";
35
36 propagatedBuildInputs = [
37 attrs
38 sortedcontainers
39 ];
40
41 checkInputs = [
42 pexpect
43 pytest-xdist
44 pytestCheckHook
45 ] ++ lib.optional (pythonAtLeast "3.9") [
46 tzdata
47 ];
48
49 inherit doCheck;
50
51 # This file changes how pytest runs and breaks it
52 preCheck = ''
53 rm tox.ini
54 '';
55
56 pytestFlagsArray = [
57 "tests/cover"
58 ];
59
60 pythonImportsCheck = [
61 "hypothesis"
62 ];
63
64 meta = with lib; {
65 description = "Library for property based testing";
66 homepage = "https://github.com/HypothesisWorks/hypothesis";
67 license = licenses.mpl20;
68 maintainers = with maintainers; [ SuperSandro2000 ];
69 };
70}