1{
2 lib,
3 aspectlib,
4 buildPythonPackage,
5 elasticsearch,
6 fetchFromGitHub,
7 freezegun,
8 git,
9 mercurial,
10 nbmake,
11 py-cpuinfo,
12 pygal,
13 pytest,
14 pytestCheckHook,
15 pytest-xdist,
16 pythonAtLeast,
17 pythonOlder,
18 setuptools,
19}:
20
21buildPythonPackage rec {
22 pname = "pytest-benchmark";
23 version = "5.1.0";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "ionelmc";
28 repo = "pytest-benchmark";
29 tag = "v${version}";
30 hash = "sha256-4fD9UfZ6jtY7Gx/PVzd1JNWeQNz+DJ2kQmCku2TgxzI=";
31 };
32
33 build-system = [ setuptools ];
34
35 buildInputs = [ pytest ];
36
37 dependencies = [ py-cpuinfo ];
38
39 optional-dependencies = {
40 aspect = [ aspectlib ];
41 histogram = [
42 pygal
43 # FIXME package pygaljs
44 setuptools
45 ];
46 elasticsearch = [ elasticsearch ];
47 };
48
49 pythonImportsCheck = [ "pytest_benchmark" ];
50
51 __darwinAllowLocalNetworking = true;
52
53 nativeCheckInputs = [
54 freezegun
55 git
56 mercurial
57 nbmake
58 pytestCheckHook
59 pytest-xdist
60 ]
61 ++ lib.flatten (lib.attrValues optional-dependencies);
62
63 preCheck = ''
64 export PATH="$out/bin:$PATH"
65 export HOME=$(mktemp -d)
66 '';
67
68 disabledTests =
69 lib.optionals (pythonOlder "3.12") [
70 # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec'
71 "test_compare_1"
72 "test_compare_2"
73 "test_regression_checks"
74 "test_regression_checks_inf"
75 "test_rendering"
76 ]
77 ++ lib.optionals (pythonAtLeast "3.13") [
78 # argparse usage changes mismatches test artifact
79 "test_help"
80 ];
81
82 meta = {
83 changelog = "https://github.com/ionelmc/pytest-benchmark/blob/${src.rev}/CHANGELOG.rst";
84 description = "Pytest fixture for benchmarking code";
85 homepage = "https://github.com/ionelmc/pytest-benchmark";
86 license = lib.licenses.bsd2;
87 maintainers = with lib.maintainers; [ dotlambda ];
88 };
89}