1{
2 buildPythonPackage,
3 isPyPy,
4 pytest,
5}:
6
7buildPythonPackage rec {
8 pname = "pytest-tests";
9 inherit (pytest) version;
10 format = "other";
11
12 src = pytest.testout;
13
14 dontBuild = true;
15 dontInstall = true;
16
17 nativeCheckInputs = pytest.optional-dependencies.testing;
18
19 doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
20
21 # Ignored file https://github.com/pytest-dev/pytest/pull/5605#issuecomment-522243929
22 # test_missing_required_plugins will emit deprecation warning which is treated as error
23 checkPhase = ''
24 runHook preCheck
25 ${pytest.out}/bin/pytest -x testing/ \
26 --ignore=testing/test_junitxml.py \
27 --ignore=testing/test_argcomplete.py \
28 -k "not test_collect_pyargs_with_testpaths and not test_missing_required_plugins"
29
30 # tests leave behind unreproducible pytest binaries in the output directory, remove:
31 find $out/lib -name "*-pytest-${version}.pyc" -delete
32 # specifically testing/test_assertion.py and testing/test_assertrewrite.py leave behind those:
33 find $out/lib -name "*opt-2.pyc" -delete
34
35 runHook postCheck
36 '';
37}