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