python311Packages.pytest: clean up deps, expose testing extra

This commit is contained in:
Martin Weinelt
2023-12-20 20:45:51 +01:00
parent 9be98b9712
commit 536b7d1039
2 changed files with 29 additions and 13 deletions
@@ -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
@@ -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"