Unverified Commit 6f72e87e authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

Merge pull request #228439 from dotlambda/pytest-benchmark-test

parents 2b389844 c6355a70
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -13,7 +13,6 @@
, cffi
, pkg-config
, pytestCheckHook
, pytest-benchmark
, pytest-subtests
, pythonOlder
, pretend
@@ -46,6 +45,11 @@ buildPythonPackage rec {
    hash = "sha256-gFfDTc2QWBWHBCycVH1dYlCsWQMVcRZfOBIau+njtDU=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "--benchmark-disable" ""
  '';

  cargoRoot = "src/rust";

  nativeBuildInputs = lib.optionals (!isPyPy) [
@@ -72,7 +76,6 @@ buildPythonPackage rec {
    pretend
    py
    pytestCheckHook
    pytest-benchmark
    pytest-subtests
    pytz
  ];
@@ -81,7 +84,10 @@ buildPythonPackage rec {
    "--disable-pytest-warnings"
  ];

  disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
  disabledTestPaths = [
    # save compute time by not running benchmarks
    "tests/bench"
  ] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
    # aarch64-darwin forbids W+X memory, but this tests depends on it:
    # * https://cffi.readthedocs.io/en/latest/using.html#callbacks
    "tests/hazmat/backends/test_openssl_memleak.py"
+42 −9
Original line number Diff line number Diff line
{ lib
, aspectlib
, buildPythonPackage
, elasticsearch
, fetchFromGitHub
, pathlib
, fetchpatch
, freezegun
, git
, mercurial
, py-cpuinfo
, pygal
, pytest
, pytestCheckHook
, pythonOlder
, statistics
}:

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

  disabled = pythonOlder "3.7";

  format = "setuptools";

  src = fetchFromGitHub {
@@ -20,28 +29,52 @@ buildPythonPackage rec {
    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
  ] ++ lib.optionals (pythonOlder "3.4") [
    pathlib
    statistics
  ];

  # Circular dependency
  doCheck = false;

  pythonImportsCheck = [
    "pytest_benchmark"
  ];

  nativeCheckInputs = [
    aspectlib
    elasticsearch
    freezegun
    git
    mercurial
    pygal
    pytestCheckHook
  ];

  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"
  ];

  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; [ costrouc ];
    maintainers = with maintainers; [ dotlambda ];
  };
}