python3Packages.lxml-html-clean: skip failing tests

This commit is contained in:
Gaetan Lepage
2025-06-24 07:51:25 +02:00
parent b0dc55b783
commit d922803017

View File

@@ -2,10 +2,9 @@
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
lxml,
unittestCheckHook,
pythonOlder,
setuptools,
}:
buildPythonPackage rec {
@@ -13,8 +12,6 @@ buildPythonPackage rec {
version = "0.4.2";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "fedora-python";
repo = "lxml_html_clean";
@@ -22,6 +19,22 @@ buildPythonPackage rec {
hash = "sha256-KGUFRbcaeDcX2jyoyyZMZsVTbN+h8uy+ugcritkZe38=";
};
# Disable failing snapshot tests (AssertionError)
# https://github.com/fedora-python/lxml_html_clean/issues/24
# As this derivation must use unittestCheckHook, we cannot use disabledTests
postPatch = ''
substituteInPlace tests/test_clean.py \
--replace-fail \
"test_host_whitelist_valid" \
"DISABLED_test_host_whitelist_valid" \
--replace-fail \
"test_host_whitelist_invalid" \
"DISABLED_test_host_whitelist_invalid" \
--replace-fail \
"test_host_whitelist_sneaky_userinfo" \
"DISABLED_test_host_whitelist_sneaky_userinfo"
'';
build-system = [ setuptools ];
dependencies = [ lxml ];
@@ -30,11 +43,11 @@ buildPythonPackage rec {
pythonImportsCheck = [ "lxml_html_clean" ];
meta = with lib; {
meta = {
description = "Separate project for HTML cleaning functionalities copied from lxml.html.clean";
homepage = "https://github.com/fedora-python/lxml_html_clean/";
changelog = "https://github.com/fedora-python/lxml_html_clean/blob/${version}/CHANGES.rst";
license = licenses.bsd3;
maintainers = with maintainers; [ fab ];
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ fab ];
};
}