From d9228030170cfe00899d69f70a04cfe41d6c61f4 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 24 Jun 2025 07:51:25 +0200 Subject: [PATCH 1/3] python3Packages.lxml-html-clean: skip failing tests --- .../lxml-html-clean/default.nix | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/lxml-html-clean/default.nix b/pkgs/development/python-modules/lxml-html-clean/default.nix index 36c2e7e478eb..07fbef60093a 100644 --- a/pkgs/development/python-modules/lxml-html-clean/default.nix +++ b/pkgs/development/python-modules/lxml-html-clean/default.nix @@ -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 ]; }; } From 600d6be8d99062733138e51cfe2930a61c8676ad Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 25 Jun 2025 09:17:34 +0200 Subject: [PATCH 2/3] python3Packages.trafilatura: skip failing tests, cleanup https://github.com/adbar/trafilatura/issues/805 --- .../python-modules/trafilatura/default.nix | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/trafilatura/default.nix b/pkgs/development/python-modules/trafilatura/default.nix index ecbad785b0f1..57d236ffeb03 100644 --- a/pkgs/development/python-modules/trafilatura/default.nix +++ b/pkgs/development/python-modules/trafilatura/default.nix @@ -1,17 +1,22 @@ { lib, buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies certifi, charset-normalizer, courlan, - fetchPypi, htmldate, justext, lxml, - pytestCheckHook, - pythonOlder, - setuptools, urllib3, + + # tests + pytestCheckHook, }: buildPythonPackage rec { @@ -19,11 +24,11 @@ buildPythonPackage rec { version = "2.0.0"; pyproject = true; - disabled = pythonOlder "3.9"; - - src = fetchPypi { - inherit pname version; - hash = "sha256-zrcJSm7Ml+cv6nPH26NnFMXFtXe2Rw5FINyok3BtYkc="; + src = fetchFromGitHub { + owner = "adbar"; + repo = "trafilatura"; + tag = "v${version}"; + hash = "sha256-Cf1W3JEGSMkVmRZVTXYsXzZK/Nt/aDG890Sf0/0OZAA="; }; postPatch = '' @@ -48,6 +53,15 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook ]; disabledTests = [ + # TypeError: argument of type 'NoneType' is not iterable + # https://github.com/adbar/trafilatura/issues/805 + "test_external" + "test_extract" + + # AttributeError: 'NoneType' object has no attribute 'find' + # https://github.com/adbar/trafilatura/issues/805 + "test_table_processing" + # Disable tests that require an internet connection "test_cli_pipeline" "test_crawl_page" From 9789685dae1fb618ffb84dd61847e877db8a9b0c Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 25 Jun 2025 09:20:21 +0200 Subject: [PATCH 3/3] python3Packages.html-sanitizer: skip failing test https://github.com/matthiask/html-sanitizer/issues/53 --- .../python-modules/html-sanitizer/default.nix | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/html-sanitizer/default.nix b/pkgs/development/python-modules/html-sanitizer/default.nix index aec0c2039155..c978fdd02f6a 100644 --- a/pkgs/development/python-modules/html-sanitizer/default.nix +++ b/pkgs/development/python-modules/html-sanitizer/default.nix @@ -2,12 +2,17 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system hatchling, + + # dependencies lxml, lxml-html-clean, beautifulsoup4, + + # tests pytestCheckHook, - pythonOlder, }: buildPythonPackage rec { @@ -15,8 +20,6 @@ buildPythonPackage rec { version = "2.4.4"; pyproject = true; - disabled = pythonOlder "3.7"; - src = fetchFromGitHub { owner = "matthiask"; repo = "html-sanitizer"; @@ -24,9 +27,9 @@ buildPythonPackage rec { hash = "sha256-6OWFLsuefeDzQ1uHnLmboKDgrbY/xJCwqsSQlDaJlRs="; }; - nativeBuildInputs = [ hatchling ]; + build-system = [ hatchling ]; - propagatedBuildInputs = [ + dependencies = [ lxml lxml-html-clean beautifulsoup4 @@ -40,15 +43,19 @@ buildPythonPackage rec { # Tests are sensitive to output "test_billion_laughs" "test_10_broken_html" + + # Mismatch snapshot (AssertionError) + # https://github.com/matthiask/html-sanitizer/issues/53 + "test_keep_typographic_whitespace" ]; pythonImportsCheck = [ "html_sanitizer" ]; - meta = with lib; { + meta = { description = "Allowlist-based and very opinionated HTML sanitizer"; homepage = "https://github.com/matthiask/html-sanitizer"; changelog = "https://github.com/matthiask/html-sanitizer/blob/${version}/CHANGELOG.rst"; - license = with licenses; [ bsd3 ]; - maintainers = with maintainers; [ fab ]; + license = with lib.licenses; [ bsd3 ]; + maintainers = with lib.maintainers; [ fab ]; }; }