about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pytest-benchmark/default.nix
blob: f9011b6d721bba7585bdc61517d91774a05418c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{ lib
, aspectlib
, buildPythonPackage
, elasticsearch
, elastic-transport
, fetchFromGitHub
, fetchpatch
, freezegun
, git
, mercurial
, py-cpuinfo
, pygal
, pytest
, pytestCheckHook
, pytest-xdist
, pythonOlder
, isPy311
}:

buildPythonPackage rec {
  pname = "pytest-benchmark";
  version = "4.0.0";

  disabled = pythonOlder "3.7";

  format = "setuptools";

  src = fetchFromGitHub {
    owner = "ionelmc";
    repo = pname;
    rev = "v${version}";
    hash = "sha256-f9Ty4+5PycraxoLUSa9JFusV5Cot6bBWKfOGHZIRR3o=";
  };

  patches = [
    (fetchpatch {
      url = "https://github.com/ionelmc/pytest-benchmark/commit/728752d2976ef53fde7e40beb3e55f09cf4d4736.patch";
      hash = "sha256-WIQADCLey5Y79UJUj9J5E02HQ0O86xBh/3IeGLpVrWI=";
    })
  ];

  buildInputs = [
    pytest
  ];

  propagatedBuildInputs = [
    py-cpuinfo
  ];

  passthru.optional-dependencies = {
    aspect = [ aspectlib ];
    histogram = [ pygal ];
    elasticsearch = [ elasticsearch ];
  };

  pythonImportsCheck = [
    "pytest_benchmark"
  ];

  nativeCheckInputs = [
    elastic-transport
    freezegun
    git
    mercurial
    pytestCheckHook
    pytest-xdist
  ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);

  preCheck = ''
    export PATH="$out/bin:$PATH"
  '';

  disabledTests = [
    # AttributeError: 'PluginImportFixer' object has no attribute 'find_spec'
    "test_compare_1"
    "test_compare_2"
    "test_regression_checks"
    "test_rendering"
  ]
  # tests are broken in 3.11
  # https://github.com/ionelmc/pytest-benchmark/issues/231
  ++ lib.optionals isPy311 [
    "test_abort_broken"
    "test_clonefunc"
  ];

  meta = with lib; {
    changelog = "https://github.com/ionelmc/pytest-benchmark/blob/${src.rev}/CHANGELOG.rst";
    description = "Pytest fixture for benchmarking code";
    homepage = "https://github.com/ionelmc/pytest-benchmark";
    license = licenses.bsd2;
    maintainers = with maintainers; [ dotlambda ];
  };
}