python2Packages.pytest: drop

This commit is contained in:
Sigmanificient
2026-01-15 01:38:29 +01:00
parent 50476a84be
commit d6648d8493
7 changed files with 3 additions and 123 deletions
@@ -7,7 +7,6 @@
six,
pbr,
unittestCheckHook,
pytest,
}:
buildPythonPackage rec {
@@ -35,7 +34,6 @@ buildPythonPackage rec {
nativeCheckInputs = [
unittestCheckHook
pytest
];
meta = {
@@ -4,7 +4,6 @@
fetchPypi,
pyparsing,
six,
pytestCheckHook,
pretend,
}:
@@ -27,7 +26,6 @@ buildPythonPackage rec {
];
nativeCheckInputs = [
pytestCheckHook
pretend
];
@@ -7,7 +7,6 @@
scripttest,
virtualenv,
pretend,
pytest,
}:
buildPythonPackage rec {
@@ -34,8 +33,8 @@ buildPythonPackage rec {
scripttest
virtualenv
pretend
pytest
];
# Pip wants pytest, but tests are not distributed
doCheck = false;
@@ -16,10 +16,6 @@ buildPythonPackage rec {
sha256 = "15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0";
};
checkPhase = ''
py.test
'';
# To prevent infinite recursion with pytest
doCheck = false;
@@ -1,100 +0,0 @@
{
lib,
buildPythonPackage,
fetchPypi,
attrs,
py,
setuptools-scm,
setuptools,
six,
pluggy,
funcsigs,
isPy3k,
more-itertools,
atomicwrites,
mock,
writeText,
wcwidth,
packaging,
isPyPy,
}:
buildPythonPackage rec {
version = "4.6.11";
format = "setuptools";
pname = "pytest";
src = fetchPypi {
inherit pname version;
sha256 = "50fa82392f2120cc3ec2ca0a75ee615be4c479e66669789771f1758332be4353";
};
postPatch = ''
substituteInPlace setup.py \
--replace "pluggy>=0.12,<1.0" "pluggy>=0.12,<2.0"
'';
nativeCheckInputs = [
mock
];
buildInputs = [ setuptools-scm ];
propagatedBuildInputs = [
attrs
py
setuptools
six
pluggy
more-itertools
atomicwrites
wcwidth
packaging
]
++ lib.optionals (!isPy3k) [ funcsigs ];
doCheck = !isPyPy; # https://github.com/pytest-dev/pytest/issues/3460
checkPhase = ''
runHook preCheck
# don't test bash builtins
rm testing/test_argcomplete.py
# determinism - this test writes non deterministic bytecode
rm -rf testing/test_assertrewrite.py
PYTHONDONTWRITEBYTECODE=1 $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths"
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 {} +
}
appendToVar preDistPhases pytestcachePhase
# pytest generates it's own bytecode files to improve assertion messages.
# These files similar to cpython's bytecode files but are never laoded
# by python interpreter directly. We remove them for a few reasons:
# - files are non-deterministic: https://github.com/NixOS/nixpkgs/issues/139292
# (file headers are generatedt by pytest directly and contain timestamps)
# - files are not needed after tests are finished
pytestRemoveBytecodePhase () {
# suffix is defined at:
# https://github.com/pytest-dev/pytest/blob/4.6.11/src/_pytest/assertion/rewrite.py#L32-L47
find $out -name "*-PYTEST.py[co]" -delete
}
appendToVar preDistPhases pytestRemoveBytecodePhase
'';
meta = {
homepage = "https://docs.pytest.org";
description = "Framework for writing tests";
maintainers = with lib.maintainers; [
lovek323
madjar
];
license = lib.licenses.mit;
platforms = lib.platforms.unix;
};
}
@@ -3,8 +3,6 @@
buildPythonPackage,
fetchPypi,
setuptools-scm,
pytest,
pytest-flake8,
more-itertools,
}:
@@ -22,15 +20,6 @@ buildPythonPackage rec {
propagatedBuildInputs = [ more-itertools ];
nativeCheckInputs = [
pytest
pytest-flake8
];
checkPhase = ''
pytest
'';
# Prevent infinite recursion with pytest
doCheck = false;
+2 -2
View File
@@ -51,9 +51,9 @@ with super;
pyparsing = disabled super.pyparsing;
pytest = pytest_4;
pytest = disabled super.pytest;
pytest_4 = callPackage ../development/python2-modules/pytest { };
pytest_4 = disabled super.pytest;
pytest-xdist = disabled super.pytest-xdist;