1{ lib
2, aspectlib
3, buildPythonPackage
4, elasticsearch
5, fetchFromGitHub
6, fetchpatch
7, freezegun
8, git
9, mercurial
10, py-cpuinfo
11, pygal
12, pytest
13, pytestCheckHook
14, pythonOlder
15, isPy311
16}:
17
18buildPythonPackage rec {
19 pname = "pytest-benchmark";
20 version = "4.0.0";
21
22 disabled = pythonOlder "3.7";
23
24 format = "setuptools";
25
26 src = fetchFromGitHub {
27 owner = "ionelmc";
28 repo = pname;
29 rev = "v${version}";
30 hash = "sha256-f9Ty4+5PycraxoLUSa9JFusV5Cot6bBWKfOGHZIRR3o=";
31 };
32
33 patches = [
34 (fetchpatch {
35 url = "https://github.com/ionelmc/pytest-benchmark/commit/728752d2976ef53fde7e40beb3e55f09cf4d4736.patch";
36 hash = "sha256-WIQADCLey5Y79UJUj9J5E02HQ0O86xBh/3IeGLpVrWI=";
37 })
38 ];
39
40 buildInputs = [
41 pytest
42 ];
43
44 propagatedBuildInputs = [
45 py-cpuinfo
46 ];
47
48 pythonImportsCheck = [
49 "pytest_benchmark"
50 ];
51
52 nativeCheckInputs = [
53 aspectlib
54 elasticsearch
55 freezegun
56 git
57 mercurial
58 pygal
59 pytestCheckHook
60 ];
61
62 preCheck = ''
63 export PATH="$out/bin:$PATH"
64 '';
65
66 disabledTests = [
67 # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec'
68 "test_compare_1"
69 "test_compare_2"
70 "test_regression_checks"
71 "test_rendering"
72 ]
73 # tests are broken in 3.11
74 # https://github.com/ionelmc/pytest-benchmark/issues/231
75 ++ lib.optionals isPy311 [
76 "test_abort_broken"
77 "test_clonefunc"
78 ];
79
80 meta = with lib; {
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 = licenses.bsd2;
85 maintainers = with maintainers; [ dotlambda ];
86 };
87}