From ea547c89730a8dae586a8be89ca124e4dcd0a041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 26 Apr 2023 19:02:49 -0700 Subject: [PATCH 1/2] python310Packages.cryptography: don't depend on pytest-benchmark --- .../python-modules/cryptography/default.nix | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/cryptography/default.nix b/pkgs/development/python-modules/cryptography/default.nix index 578d13acf43d..e7c07daa5878 100644 --- a/pkgs/development/python-modules/cryptography/default.nix +++ b/pkgs/development/python-modules/cryptography/default.nix @@ -13,7 +13,6 @@ , cffi , pkg-config , pytestCheckHook -, pytest-benchmark , pytest-subtests , pythonOlder , pretend @@ -45,6 +44,11 @@ buildPythonPackage rec { hash = "sha256-gFfDTc2QWBWHBCycVH1dYlCsWQMVcRZfOBIau+njtDU="; }; + postPatch = '' + substituteInPlace pyproject.toml \ + --replace "--benchmark-disable" "" + ''; + cargoRoot = "src/rust"; nativeBuildInputs = lib.optionals (!isPyPy) [ @@ -70,7 +74,6 @@ buildPythonPackage rec { pretend py pytestCheckHook - pytest-benchmark pytest-subtests pytz ]; @@ -79,7 +82,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" From c6355a709ca1a10144d53a0c6e4926e63c9a3223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 26 Apr 2023 19:11:36 -0700 Subject: [PATCH 2/2] python310Packages.pytest-benchmark: run tests --- .../pytest-benchmark/default.nix | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/pytest-benchmark/default.nix b/pkgs/development/python-modules/pytest-benchmark/default.nix index 6fd0cefb51c3..4117d2e658c5 100644 --- a/pkgs/development/python-modules/pytest-benchmark/default.nix +++ b/pkgs/development/python-modules/pytest-benchmark/default.nix @@ -1,16 +1,25 @@ { 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 ]; }; }