Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pytest-benchmark / default.nix
blobdc2c27137169141d5b2b65e0a3d31375d9976630
1 { lib
2 , aspectlib
3 , buildPythonPackage
4 , elasticsearch
5 , elastic-transport
6 , fetchFromGitHub
7 , fetchpatch
8 , freezegun
9 , git
10 , mercurial
11 , py-cpuinfo
12 , pygal
13 , pytest
14 , pytestCheckHook
15 , pytest-xdist
16 , pythonOlder
17 , setuptools
20 buildPythonPackage rec {
21   pname = "pytest-benchmark";
22   version = "4.0.0";
23   pyproject = true;
25   disabled = pythonOlder "3.7";
28   src = fetchFromGitHub {
29     owner = "ionelmc";
30     repo = pname;
31     rev = "v${version}";
32     hash = "sha256-f9Ty4+5PycraxoLUSa9JFusV5Cot6bBWKfOGHZIRR3o=";
33   };
35   patches = [
36     # replace distutils.spawn.find_executable with shutil.which
37     (fetchpatch {
38       url = "https://github.com/ionelmc/pytest-benchmark/commit/728752d2976ef53fde7e40beb3e55f09cf4d4736.patch";
39       hash = "sha256-WIQADCLey5Y79UJUj9J5E02HQ0O86xBh/3IeGLpVrWI=";
40     })
41     # fix tests with python3.11+; https://github.com/ionelmc/pytest-benchmark/pull/232
42     (fetchpatch {
43       url = "https://github.com/ionelmc/pytest-benchmark/commit/b2f624afd68a3090f20187a46284904dd4baa4f6.patch";
44       hash = "sha256-cylxPj/d0YzvOGw+ncVSCnQHwq2cukrgXhBHePPwjO0=";
45     })
46     (fetchpatch {
47       url = "https://github.com/ionelmc/pytest-benchmark/commit/2b987f5be1873617f02f24cb6d76196f9aed21bd.patch";
48       hash = "sha256-92kWEd935Co6uc/1y5OGKsc5/or81bORSdaiQFjDyTw=";
49     })
50   ];
52   nativeBuildInputs = [
53     setuptools
54   ];
56   buildInputs = [
57     pytest
58   ];
60   propagatedBuildInputs = [
61     py-cpuinfo
62   ];
64   passthru.optional-dependencies = {
65     aspect = [ aspectlib ];
66     histogram = [ pygal ];
67     elasticsearch = [ elasticsearch ];
68   };
70   pythonImportsCheck = [
71     "pytest_benchmark"
72   ];
74   nativeCheckInputs = [
75     elastic-transport
76     freezegun
77     git
78     mercurial
79     pytestCheckHook
80     pytest-xdist
81   ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
83   pytestFlagsArray = [
84     "-W" "ignore::DeprecationWarning"
85   ];
87   preCheck = ''
88     export PATH="$out/bin:$PATH"
89   '';
91   disabledTests = lib.optionals (pythonOlder "3.12") [
92     # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec'
93     "test_compare_1"
94     "test_compare_2"
95     "test_regression_checks"
96     "test_regression_checks_inf"
97     "test_rendering"
98   ];
100   meta = with lib; {
101     changelog = "https://github.com/ionelmc/pytest-benchmark/blob/${src.rev}/CHANGELOG.rst";
102     description = "Pytest fixture for benchmarking code";
103     homepage = "https://github.com/ionelmc/pytest-benchmark";
104     license = licenses.bsd2;
105     maintainers = with maintainers; [ dotlambda ];
106   };