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 ] ++ lib.flatten (lib.attrValues optional-dependencies);
61
62 preCheck = ''
63 export PATH="$out/bin:$PATH"
64 export HOME=$(mktemp -d)
65 '';
66
67 disabledTests =
68 lib.optionals (pythonOlder "3.12") [
69 # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec'
70 "test_compare_1"
71 "test_compare_2"
72 "test_regression_checks"
73 "test_regression_checks_inf"
74 "test_rendering"
75 ]
76 ++ lib.optionals (pythonAtLeast "3.13") [
77 # argparse usage changes mismatches test artifact
78 "test_help"
79 ];
80
81 meta = {
82 changelog = "https://github.com/ionelmc/pytest-benchmark/blob/${src.rev}/CHANGELOG.rst";
83 description = "Pytest fixture for benchmarking code";
84 homepage = "https://github.com/ionelmc/pytest-benchmark";
85 license = lib.licenses.bsd2;
86 maintainers = with lib.maintainers; [ dotlambda ];
87 };
88}