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, isPy311 18}: 19 20buildPythonPackage rec { 21 pname = "pytest-benchmark"; 22 version = "4.0.0"; 23 24 disabled = pythonOlder "3.7"; 25 26 format = "setuptools"; 27 28 src = fetchFromGitHub { 29 owner = "ionelmc"; 30 repo = pname; 31 rev = "v${version}"; 32 hash = "sha256-f9Ty4+5PycraxoLUSa9JFusV5Cot6bBWKfOGHZIRR3o="; 33 }; 34 35 patches = [ 36 (fetchpatch { 37 url = "https://github.com/ionelmc/pytest-benchmark/commit/728752d2976ef53fde7e40beb3e55f09cf4d4736.patch"; 38 hash = "sha256-WIQADCLey5Y79UJUj9J5E02HQ0O86xBh/3IeGLpVrWI="; 39 }) 40 ]; 41 42 buildInputs = [ 43 pytest 44 ]; 45 46 propagatedBuildInputs = [ 47 py-cpuinfo 48 ]; 49 50 passthru.optional-dependencies = { 51 aspect = [ aspectlib ]; 52 histogram = [ pygal ]; 53 elasticsearch = [ elasticsearch ]; 54 }; 55 56 pythonImportsCheck = [ 57 "pytest_benchmark" 58 ]; 59 60 nativeCheckInputs = [ 61 elastic-transport 62 freezegun 63 git 64 mercurial 65 pytestCheckHook 66 pytest-xdist 67 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); 68 69 preCheck = '' 70 export PATH="$out/bin:$PATH" 71 ''; 72 73 disabledTests = [ 74 # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec' 75 "test_compare_1" 76 "test_compare_2" 77 "test_regression_checks" 78 "test_rendering" 79 ] 80 # tests are broken in 3.11 81 # https://github.com/ionelmc/pytest-benchmark/issues/231 82 ++ lib.optionals isPy311 [ 83 "test_abort_broken" 84 "test_clonefunc" 85 ]; 86 87 meta = with lib; { 88 changelog = "https://github.com/ionelmc/pytest-benchmark/blob/${src.rev}/CHANGELOG.rst"; 89 description = "Pytest fixture for benchmarking code"; 90 homepage = "https://github.com/ionelmc/pytest-benchmark"; 91 license = licenses.bsd2; 92 maintainers = with maintainers; [ dotlambda ]; 93 }; 94}