treewide: replace all pytest-cov patching outside of pythonPackages with pytest-cov-stub

This commit is contained in:
Sandro Jäckel 2024-08-23 15:12:04 +02:00
parent 9242a662c6
commit ca355f14c8
No known key found for this signature in database
GPG Key ID: 3AF5A43A3EECC2E5
27 changed files with 47 additions and 120 deletions

View File

@ -47,7 +47,7 @@ python311Packages.buildPythonApplication rec {
minimock
pytest
pytest-httpserver
pytest-cov
pytest-cov-stub
];
doCheck = true;

View File

@ -19,6 +19,7 @@
, proton-vpn-session
, pycairo
, pygobject3
, pytest-cov-stub
, pytestCheckHook
, withIndicator ? true
, libappindicator-gtk3
@ -69,11 +70,6 @@ buildPythonApplication rec {
pygobject3
];
postPatch = ''
substituteInPlace setup.cfg \
--replace-fail "--cov=proton --cov-report=html --cov-report=term" ""
'';
postInstall = ''
mkdir -p $out/share/{applications,pixmaps}
install -Dm 644 ${src}/rpmbuild/SOURCES/protonvpn-app.desktop $out/share/applications
@ -81,6 +77,7 @@ buildPythonApplication rec {
'';
nativeCheckInputs = [
pytest-cov-stub
pytestCheckHook
];

View File

@ -219,6 +219,7 @@ python.pkgs.buildPythonApplication rec {
daphne
factory-boy
imagehash
pytest-cov-stub
pytest-django
pytest-env
pytest-httpx
@ -240,10 +241,6 @@ python.pkgs.buildPythonApplication rec {
export PATH="${path}:$PATH"
export HOME=$(mktemp -d)
export XDG_DATA_DIRS="${liberation_ttf}/share:$XDG_DATA_DIRS"
# Disable unneeded code coverage test
substituteInPlace src/setup.cfg \
--replace-fail "--cov --cov-report=html --cov-report=xml" ""
'';
disabledTests = [

View File

@ -3,6 +3,7 @@
, fetchFromGitHub
, git
, pytestCheckHook
, pytest-cov-stub
, pytest-mock
}:
@ -28,7 +29,6 @@ buildPythonApplication rec {
--replace pytest==5.2.2 pytest \
--replace pytest-cov==2.8.1 "" \
--replace pytest-mock==1.11.2 pytest-mock \
--replace "--cov=git_archive_all --cov-report=term --cov-branch" "" \
--replace "filterwarnings = error" ""
substituteInPlace test_git_archive_all.py \
--replace "import pycodestyle" ""
@ -40,6 +40,7 @@ buildPythonApplication rec {
checkInputs = [
pytestCheckHook
pytest-cov-stub
pytest-mock
];

View File

@ -17,11 +17,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-AJ0ZWRxqhBJEics6XnIVWyf7pJI8MphQU4LRqSYYNSQ=";
};
postPatch = ''
substituteInPlace setup.cfg \
--replace-fail '--cov-config=setup.cfg' ""
'';
dependencies = with python3.pkgs; [
dbus-python
icalendar
@ -40,6 +35,7 @@ python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = with python3.pkgs; [
dbus
freezegun
pytest-cov-stub
pytest-datadir
pytest-httpserver
pytest-mock

View File

@ -18,18 +18,13 @@ python3Packages.buildPythonApplication rec {
hash = "sha256-/OuWwerBlJynEibaYo+jkLpHt4x9GZrqMRJNxgrDBlM=";
};
postPatch = ''
# We don't need to test coverage, so remove these checks
substituteInPlace setup.cfg \
--replace-fail "addopts = --cov-fail-under=84 --cov=./cmakelint" ""
'';
build-system = [ python3Packages.setuptools ];
pythonImportsCheck = [ "cmakelint" ];
nativeCheckInputs = [
python3Packages.pytestCheckHook
python3Packages.pytest-cov-stub
];
passthru.tests = {

View File

@ -16,11 +16,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-5iMhl3Wcxwgq4Wr0TUcAuRnb2+y8DHBugnnkpcZfSAM=";
};
postPatch = ''
substituteInPlace pytest.ini \
--replace-fail " --cov-append --cov-report term --cov depscan" ""
'';
build-system = with python3.pkgs; [ setuptools ];
dependencies = with python3.pkgs; [
@ -40,6 +35,7 @@ python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = with python3.pkgs; [
httpretty
pytest-cov-stub
pytestCheckHook
];

View File

@ -16,11 +16,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-vXQFgP0KDWo1VWe7tMGCB2yEYlr/1KMXsiNupBVLBqc=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "--cov=gato" ""
'';
nativeBuildInputs = with python3.pkgs; [
setuptools
wheel
@ -36,6 +31,7 @@ python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = with python3.pkgs; [
git
pytest-cov-stub
pytestCheckHook
];

View File

@ -20,11 +20,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-3IiFU6qGI2MDTBOLQ2qyT5keUMNTNG3sxhtGR3bkIBc=";
};
postPatch = ''
# We don't want to run the coverage.
substituteInPlace tox.ini --replace "--cov=git_pw --cov-report" ""
'';
nativeBuildInputs = with python3.pkgs; [
pbr
setuptools
@ -39,6 +34,7 @@ python3.pkgs.buildPythonApplication rec {
];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytest
git
];

View File

@ -31,12 +31,10 @@ python3Packages.buildPythonApplication rec {
++ typed-settings.optional-dependencies.cattrs
++ typed-settings.optional-dependencies.click;
preCheck = ''
substituteInPlace pyproject.toml \
--replace-fail "--cov makejinja --cov-report term-missing" ""
'';
nativeCheckInputs = with python3Packages; [ pytestCheckHook ];
nativeCheckInputs = with python3Packages; [
pytest-cov-stub
pytestCheckHook
];
meta = {
description = "Generate entire directory structures using Jinja templates with support for external data and custom plugins";

View File

@ -16,7 +16,7 @@ python3.pkgs.buildPythonApplication rec {
};
postPatch = ''
substituteInPlace setup.cfg --replace-fail "--flake8 --pylint --cov=marge" ""
substituteInPlace setup.cfg --replace-fail "--flake8 --pylint" ""
'';
nativeBuildInputs = [
@ -30,12 +30,18 @@ python3.pkgs.buildPythonApplication rec {
requests
];
nativeCheckInputs = with python3.pkgs; [ pytestCheckHook pendulum ];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytestCheckHook
pendulum
];
disabledTests = [
# test broken when run under Nix:
# "unittest.mock.InvalidSpecError: Cannot spec a Mock object."
"test_get_mr_ci_status"
];
disabledTestPaths = [
# test errors due to API mismatch in test setup:
# "ImportError: cannot import name 'set_test_now' from 'pendulum.helpers'"

View File

@ -74,9 +74,6 @@ python.pkgs.buildPythonApplication rec {
postPatch = ''
substituteInPlace src/pretalx/common/management/commands/rebuild.py \
--replace 'subprocess.check_call(["npm", "run", "build"], cwd=frontend_dir, env=env)' ""
substituteInPlace src/setup.cfg \
--replace "--cov=./ --cov-report=" ""
'';
nativeBuildInputs = [
@ -196,6 +193,7 @@ python.pkgs.buildPythonApplication rec {
faker
freezegun
jsonschema
pytest-cov-stub
pytest-django
pytest-mock
pytest-xdist

View File

@ -88,8 +88,7 @@ python.pkgs.buildPythonApplication rec {
'return str(Path("${glibc}/lib/ld-linux-x86-64.so.2"))'
substituteInPlace pyproject.toml \
--replace-fail '"pytest-cov>=4.0",' "" \
--replace-fail "--cov=snapcraft" ""
--replace-fail '"pytest-cov>=4.0",' ""
'';
nativeBuildInputs = [ makeWrapper ];
@ -155,6 +154,7 @@ python.pkgs.buildPythonApplication rec {
with python.pkgs;
[
pytest-check
pytest-cov-stub
pytest-mock
pytest-subprocess
pytestCheckHook

View File

@ -35,11 +35,6 @@ python3.pkgs.buildPythonApplication rec {
})
];
postPatch = ''
sed -i "/--cov/d" setup.cfg
sed -i "/--no-cov-on-fail/d" setup.cfg
'';
build-system = with python3.pkgs; [
flit-core
];
@ -76,6 +71,7 @@ python3.pkgs.buildPythonApplication rec {
;
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytestCheckHook
];

View File

@ -16,12 +16,6 @@ python3.pkgs.buildPythonApplication rec {
sha256 = "sha256-X3Pueu0E7Q57sbKSXqCZki4/PUb1WyWk/Zmj+lhVTM8=";
};
postPatch = ''
substituteInPlace pyproject.toml \
--replace "--cov=codespell_lib" "" \
--replace "--cov-report=" ""
'';
nativeBuildInputs = with python3.pkgs; [
setuptools-scm
];
@ -30,6 +24,7 @@ python3.pkgs.buildPythonApplication rec {
aspell-python
chardet
pytestCheckHook
pytest-cov-stub
pytest-dependency
];

View File

@ -15,11 +15,6 @@ python3Packages.buildPythonApplication rec {
hash = "sha256-6MchaqRKJPmvwiDyhCK4kFyIYl2B+2dGL8H8X2ES+VQ=";
};
postPatch = ''
# remove --cov* options provided to pytest
sed -i '/^addopts = "--cov/d' pyproject.toml
'';
nativeBuildInputs = with python3Packages; [
poetry-core
];
@ -43,6 +38,7 @@ python3Packages.buildPythonApplication rec {
pluggy
py
pyparsing
pytest-cov-stub
pytestCheckHook
];

View File

@ -3,6 +3,7 @@
, fetchFromGitHub
, fetchpatch2
, govee-led-wez
, pytest-cov-stub
, pytest-homeassistant-custom-component
, pytestCheckHook
}:
@ -26,11 +27,6 @@ buildHomeAssistantComponent {
})
];
postPatch = ''
substituteInPlace setup.cfg \
--replace-fail "--cov=custom_components" ""
'';
dontBuild = true;
propagatedBuildInputs = [
@ -41,11 +37,11 @@ buildHomeAssistantComponent {
doCheck = false;
nativeCheckInputs = [
pytest-cov-stub
pytest-homeassistant-custom-component
pytestCheckHook
];
meta = with lib; {
description = "Control Govee lights via the LAN API from Home Assistant";
homepage = "https://github.com/wez/govee-lan-hass";

View File

@ -6,6 +6,7 @@
, music-assistant
, pytestCheckHook
, pytest-asyncio
, pytest-cov-stub
, pytest-homeassistant-custom-component
}:
@ -21,10 +22,6 @@ buildHomeAssistantComponent rec {
hash = "sha256-Wvc+vUYkUJmS4U34Sh/sDCVXmQA0AtEqIT8MNXd++3M=";
};
postPatch = ''
sed -i "s/--cov//" pyproject.toml
'';
dependencies = [
async-timeout
(toPythonModule music-assistant)
@ -35,6 +32,7 @@ buildHomeAssistantComponent rec {
nativeCheckInputs = [
pytestCheckHook
pytest-asyncio
pytest-cov-stub
pytest-homeassistant-custom-component
];

View File

@ -25,11 +25,6 @@ python3.pkgs.buildPythonApplication rec {
})
];
postPatch = ''
substituteInPlace pyproject.toml \
--replace " --cov=ansiblelater --cov-report=xml:coverage.xml --cov-report=term --no-cov-on-fail" ""
'';
pythonRelaxDeps = [
"anyconfig"
"flake8"
@ -65,6 +60,7 @@ python3.pkgs.buildPythonApplication rec {
];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytest-mock
pytestCheckHook
];

View File

@ -4,7 +4,7 @@
, hypothesis
, lib
, poetry-core
, pytest
, pytest-cov-stub
, pytestCheckHook
, stringcase
}:
@ -19,10 +19,6 @@ buildPythonApplication rec {
hash = "sha256-Xmg33bqs3gQJWqkCNiWYUem3o6XsxpfbHIVvLs/2D94=";
};
postPatch = ''
sed -i pyproject.toml -e '/--cov[^"]*/d'
'';
nativeBuildInputs = [
poetry-core
];
@ -30,7 +26,7 @@ buildPythonApplication rec {
nativeCheckInputs = [
pytestCheckHook
hypothesis
pytest
pytest-cov-stub
];
propagatedBuildInputs = [

View File

@ -48,9 +48,6 @@ python.pkgs.buildPythonApplication rec {
substituteInPlace pyproject.toml \
--replace-fail "setuptools==" "setuptools>="
# drop coverage testing
sed -i '/--cov/d' pyproject.toml
# ensure component dependencies are available
cat requirements_optional.txt >> requirements.txt
# relax strict runtime version check
@ -112,6 +109,7 @@ python.pkgs.buildPythonApplication rec {
hypothesis
mock
pytest-asyncio
pytest-cov-stub
pytest-mock
pytestCheckHook
];

View File

@ -22,11 +22,6 @@ python3.pkgs.buildPythonApplication rec {
--replace \
"install_requires=[\"colored\",\"toml\",\"attr\",\"attrs\",\"gitpython\"]," \
"install_requires=[\"colored\",\"toml\",\"attrs\",\"gitpython\"],"
# pytest coverage reporting isn't necessary
substituteInPlace setup.cfg \
--replace \
"addopts = --cov=kb --cov-report term-missing" ""
'';
propagatedBuildInputs = with python3.pkgs; [
@ -37,6 +32,7 @@ python3.pkgs.buildPythonApplication rec {
];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytestCheckHook
];

View File

@ -15,17 +15,13 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-SCyCANZfi7PqexM2Kc8WJwwEEiBQxPBg0ggWsK9WB4k=";
};
postPatch = ''
substituteInPlace pytest.ini \
--replace-fail " --cov" ""
'';
build-system = with python3.pkgs; [ setuptools ];
propagatedBuildInputs = with python3.pkgs; [ docopt];
nativeCheckInputs = with python3.pkgs; [
pyfakefs
pytest-cov-stub
pytestCheckHook
];

View File

@ -32,6 +32,7 @@ python3.pkgs.buildPythonApplication rec {
];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytestCheckHook
requests-mock
];
@ -39,8 +40,7 @@ python3.pkgs.buildPythonApplication rec {
postPatch = ''
substituteInPlace setup.cfg \
--replace "dataclasses" "" \
--replace "kubernetes==12.0.1" "kubernetes" \
--replace "--cov=kube_hunter" ""
--replace "kubernetes==12.0.1" "kubernetes"
'';
pythonImportsCheck = [

View File

@ -25,11 +25,6 @@ python3Packages.buildPythonApplication rec {
patches = [ ./sudo.patch ];
postPatch = ''
substituteInPlace setup.cfg \
--replace '--cov=sshuttle --cov-branch --cov-report=term-missing' ""
'';
nativeBuildInputs = [
installShellFiles
makeWrapper
@ -37,7 +32,7 @@ python3Packages.buildPythonApplication rec {
sphinx
];
nativeCheckInputs = with python3Packages; [ pytestCheckHook ];
nativeCheckInputs = with python3Packages; [ pytest-cov-stub pytestCheckHook ];
postBuild = ''
make man -C docs

View File

@ -16,11 +16,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-Zkw+NfeVtIArrBxR1qR9bAQe5yd7mAtNiT0x5Mqr3Ic=";
};
postPatch = ''
substituteInPlace pytest.ini \
--replace-fail " --cov" ""
'';
build-system = with python3.pkgs; [ setuptools ];
dependencies =
@ -35,7 +30,10 @@ python3.pkgs.buildPythonApplication rec {
]
++ publicsuffixlist.optional-dependencies.update;
nativeCheckInputs = with python3.pkgs; [ pytestCheckHook ];
nativeCheckInputs = with python3.pkgs; [
pytest-cov-stub
pytestCheckHook
];
pythonImportsCheck = [ "trustymail" ];

View File

@ -16,12 +16,6 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-Ekh31MXqxY6iSyQRX0YZ0Tl7DFhYqGtOepYS/VObZc0=";
};
postPatch = ''
# Remove code coverage checking
substituteInPlace pyproject.toml \
--replace-fail "--cov --cov-report=xml" ""
'';
pythonRelaxDeps = true;
build-system = with python3.pkgs; [ setuptools ];
@ -61,6 +55,7 @@ python3.pkgs.buildPythonApplication rec {
nativeCheckInputs = with python3.pkgs; [
respx
pytest-asyncio
pytest-cov-stub
pytestCheckHook
];