2021-02-05 17:12:51 +00:00
|
|
|
{ lib, buildPythonPackage, pythonOlder, fetchPypi, isPy3k, isPyPy
|
2020-06-02 18:00:15 +00:00
|
|
|
, atomicwrites
|
|
|
|
, attrs
|
|
|
|
, hypothesis
|
2020-09-25 04:45:31 +00:00
|
|
|
, iniconfig
|
2020-06-02 18:00:15 +00:00
|
|
|
, more-itertools
|
|
|
|
, packaging
|
|
|
|
, pathlib2
|
|
|
|
, pluggy
|
|
|
|
, py
|
|
|
|
, pygments
|
|
|
|
, setuptools
|
2021-03-19 17:17:44 +00:00
|
|
|
, setuptools-scm
|
2020-06-02 18:00:15 +00:00
|
|
|
, six
|
2020-09-25 04:45:31 +00:00
|
|
|
, toml
|
2020-06-02 18:00:15 +00:00
|
|
|
, wcwidth
|
|
|
|
, writeText
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2020-06-02 18:00:15 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pytest";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "6.2.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = !isPy3k;
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "131b36680866a76e6781d13f101efb86cf674ebb9762eb70d3082b6f29889e89";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "pluggy>=0.12,<1.0.0a1" "pluggy>=0.23,<2.0"
|
|
|
|
'';
|
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
nativeBuildInputs = [ setuptools-scm ];
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
atomicwrites
|
|
|
|
attrs
|
|
|
|
iniconfig
|
|
|
|
more-itertools
|
|
|
|
packaging
|
|
|
|
pluggy
|
|
|
|
py
|
|
|
|
setuptools
|
|
|
|
six
|
|
|
|
toml
|
|
|
|
wcwidth
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.6") [ pathlib2 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
checkInputs = [
|
|
|
|
hypothesis
|
|
|
|
pygments
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
preCheck = ''
|
|
|
|
# don't test bash builtins
|
|
|
|
rm testing/test_argcomplete.py
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# Ignored file https://github.com/pytest-dev/pytest/pull/5605#issuecomment-522243929
|
2021-04-26 19:14:03 +00:00
|
|
|
# test_missing_required_plugins will emit deprecation warning which is treated as error
|
2020-04-24 23:36:52 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2021-04-26 19:14:03 +00:00
|
|
|
$out/bin/py.test -x testing/ \
|
|
|
|
--ignore=testing/test_junitxml.py \
|
|
|
|
-k "not test_collect_pyargs_with_testpaths and not test_missing_required_plugins"
|
2021-01-15 22:18:51 +00:00
|
|
|
|
|
|
|
# tests leave behind unreproducible pytest binaries in the output directory, remove:
|
|
|
|
find $out/lib -name "*-pytest-${version}.pyc" -delete
|
|
|
|
# specifically testing/test_assertion.py and testing/test_assertrewrite.py leave behind those:
|
|
|
|
find $out/lib -name "*opt-2.pyc" -delete
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Remove .pytest_cache when using py.test in a Nix build
|
|
|
|
setupHook = writeText "pytest-hook" ''
|
|
|
|
pytestcachePhase() {
|
|
|
|
find $out -name .pytest_cache -type d -exec rm -rf {} +
|
|
|
|
}
|
|
|
|
preDistPhases+=" pytestcachePhase"
|
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pytest"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Framework for writing tests";
|
2021-03-19 17:17:44 +00:00
|
|
|
homepage = "https://docs.pytest.org";
|
|
|
|
changelog = "https://github.com/pytest-dev/pytest/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|