linkchecker: modernize

- switch to pytestCheckHook
This commit is contained in:
Fabian Affolter 2022-12-06 22:40:36 +01:00 committed by GitHub
parent 5c1b0ff5cc
commit 915d9d054f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,16 +1,15 @@
{ stdenv, lib, fetchFromGitHub, python3Packages, gettext }: { lib
, stdenv
, fetchFromGitHub
, python3
, gettext
}:
let python3.pkgs.buildPythonApplication rec {
pypkgs = python3Packages;
in
pypkgs.buildPythonApplication rec {
pname = "linkchecker"; pname = "linkchecker";
version = "10.2.1"; version = "10.2.1";
format = "pyproject"; format = "pyproject";
disabled = pypkgs.pythonOlder "3.7";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = pname; owner = pname;
repo = pname; repo = pname;
@ -20,9 +19,11 @@ pypkgs.buildPythonApplication rec {
SETUPTOOLS_SCM_PRETEND_VERSION = version; SETUPTOOLS_SCM_PRETEND_VERSION = version;
nativeBuildInputs = [ gettext ]; nativeBuildInputs = [
gettext
];
propagatedBuildInputs = with pypkgs; [ propagatedBuildInputs = with python3.pkgs; [
argcomplete argcomplete
beautifulsoup4 beautifulsoup4
configargparse configargparse
@ -33,19 +34,26 @@ pypkgs.buildPythonApplication rec {
requests requests
]; ];
checkInputs = with pypkgs; [ checkInputs = with python3.pkgs; [
parameterized parameterized
pytest pytestCheckHook
]; ];
# test_timeit2 is flakey, and depends sleep being precise to the milisecond disabledTests = [
checkPhase = lib.optionalString stdenv.isDarwin '' # test_timeit2 is flakey, and depends sleep being precise to the milisecond
# network tests fails on darwin "TestLoginUrl"
rm tests/test_network.py tests/checker/test_http*.py tests/checker/test_content_allows_robots.py tests/checker/test_noproxy.py "test_timeit2"
'' + '' ];
pytest --ignore=tests/checker/{test_telnet,telnetserver}.py \
-k 'not TestLoginUrl and not test_timeit2' disabledTestPaths = [
''; "tests/checker/telnetserver.py"
"tests/checker/test_telnet.py"
] ++ lib.optionals stdenv.isDarwin [
"tests/checker/test_content_allows_robots.py"
"tests/checker/test_http*.py"
"tests/checker/test_noproxy.py"
"tests/test_network.py"
];
meta = with lib; { meta = with lib; {
description = "Check websites for broken links"; description = "Check websites for broken links";