From 536b7d10392b57a40f2a005f5dfc90e1744c25cf Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 5 Dec 2023 01:30:03 +0100 Subject: [PATCH] python311Packages.pytest: clean up deps, expose testing extra --- .../python-modules/pytest/default.nix | 32 +++++++++++++++---- .../python-modules/pytest/tests.nix | 10 ++---- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix index a00b59c425b7..67fb6989df01 100644 --- a/pkgs/development/python-modules/pytest/default.nix +++ b/pkgs/development/python-modules/pytest/default.nix @@ -5,18 +5,26 @@ , fetchPypi , writeText -# build +# build-system , setuptools , setuptools-scm -# propagates +# dependencies , attrs , exceptiongroup , iniconfig , packaging , pluggy -, py , tomli + +# optional-dependencies +, argcomplete +, hypothesis +, mock +, nose +, pygments +, requests +, xmlschema }: buildPythonPackage rec { @@ -40,16 +48,28 @@ buildPythonPackage rec { ]; propagatedBuildInputs = [ - attrs iniconfig packaging pluggy - py - tomli ] ++ lib.optionals (pythonOlder "3.11") [ exceptiongroup + tomli ]; + passthru.optional-dependencies = { + testing = [ + argcomplete + attrs + hypothesis + mock + nose + pygments + requests + setuptools + xmlschema + ]; + }; + postInstall = '' mkdir $testout cp -R testing $testout/testing diff --git a/pkgs/development/python-modules/pytest/tests.nix b/pkgs/development/python-modules/pytest/tests.nix index 3fc078148b20..8bf8dafdf927 100644 --- a/pkgs/development/python-modules/pytest/tests.nix +++ b/pkgs/development/python-modules/pytest/tests.nix @@ -1,23 +1,19 @@ { buildPythonPackage , isPyPy , pytest -, hypothesis -, pygments }: buildPythonPackage rec { pname = "pytest-tests"; inherit (pytest) version; + format = "other"; src = pytest.testout; dontBuild = true; dontInstall = true; - nativeCheckInputs = [ - hypothesis - pygments - ]; + nativeCheckInputs = pytest.optional-dependencies.testing; doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460 @@ -25,7 +21,7 @@ buildPythonPackage rec { # test_missing_required_plugins will emit deprecation warning which is treated as error checkPhase = '' runHook preCheck - ${pytest.out}/bin/py.test -x testing/ \ + ${pytest.out}/bin/pytest -x testing/ \ --ignore=testing/test_junitxml.py \ --ignore=testing/test_argcomplete.py \ -k "not test_collect_pyargs_with_testpaths and not test_missing_required_plugins"