Skip to content

Commit 536b7d1

Browse files
committed
python311Packages.pytest: clean up deps, expose testing extra
1 parent 9be98b9 commit 536b7d1

2 files changed

Lines changed: 29 additions & 13 deletions

File tree

pkgs/development/python-modules/pytest/default.nix

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,26 @@
55
, fetchPypi
66
, writeText
77

8-
# build
8+
# build-system
99
, setuptools
1010
, setuptools-scm
1111

12-
# propagates
12+
# dependencies
1313
, attrs
1414
, exceptiongroup
1515
, iniconfig
1616
, packaging
1717
, pluggy
18-
, py
1918
, tomli
19+
20+
# optional-dependencies
21+
, argcomplete
22+
, hypothesis
23+
, mock
24+
, nose
25+
, pygments
26+
, requests
27+
, xmlschema
2028
}:
2129

2230
buildPythonPackage rec {
@@ -40,16 +48,28 @@ buildPythonPackage rec {
4048
];
4149

4250
propagatedBuildInputs = [
43-
attrs
4451
iniconfig
4552
packaging
4653
pluggy
47-
py
48-
tomli
4954
] ++ lib.optionals (pythonOlder "3.11") [
5055
exceptiongroup
56+
tomli
5157
];
5258

59+
passthru.optional-dependencies = {
60+
testing = [
61+
argcomplete
62+
attrs
63+
hypothesis
64+
mock
65+
nose
66+
pygments
67+
requests
68+
setuptools
69+
xmlschema
70+
];
71+
};
72+
5373
postInstall = ''
5474
mkdir $testout
5575
cp -R testing $testout/testing

pkgs/development/python-modules/pytest/tests.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
{ buildPythonPackage
22
, isPyPy
33
, pytest
4-
, hypothesis
5-
, pygments
64
}:
75

86
buildPythonPackage rec {
97
pname = "pytest-tests";
108
inherit (pytest) version;
9+
format = "other";
1110

1211
src = pytest.testout;
1312

1413
dontBuild = true;
1514
dontInstall = true;
1615

17-
nativeCheckInputs = [
18-
hypothesis
19-
pygments
20-
];
16+
nativeCheckInputs = pytest.optional-dependencies.testing;
2117

2218
doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
2319

2420
# Ignored file https://github.com/pytest-dev/pytest/pull/5605#issuecomment-522243929
2521
# test_missing_required_plugins will emit deprecation warning which is treated as error
2622
checkPhase = ''
2723
runHook preCheck
28-
${pytest.out}/bin/py.test -x testing/ \
24+
${pytest.out}/bin/pytest -x testing/ \
2925
--ignore=testing/test_junitxml.py \
3026
--ignore=testing/test_argcomplete.py \
3127
-k "not test_collect_pyargs_with_testpaths and not test_missing_required_plugins"

0 commit comments

Comments
 (0)