GNU bug report logs - #54697
[PATCH] gnu: python-w3lib: Fix build.

Previous Next

Package: guix-patches;

Reported by: Felix Gruber <felgru <at> posteo.net>

Date: Sun, 3 Apr 2022 18:38:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54697 in the body.
You can then email your comments to 54697 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#54697; Package guix-patches. (Sun, 03 Apr 2022 18:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Felix Gruber <felgru <at> posteo.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 03 Apr 2022 18:38:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Felix Gruber <felgru <at> posteo.net>
To: guix-patches <at> gnu.org
Cc: Felix Gruber <felgru <at> posteo.net>
Subject: [PATCH] gnu: python-w3lib: Fix build.
Date: Sun,  3 Apr 2022 18:36:39 +0000
* gnu/packages/python-web.scm (python-w3lib): Fix build.
  [source]: Add python-w3lib-fix-test-failure.patch.
  [arguments]: Use pytest in the 'check phase.
  [native-inputs]: Add python-pytest.
* gnu/packages/patches/python-w3lib-fix-test-failure.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 .../python-w3lib-fix-test-failure.patch       | 60 +++++++++++++++++++
 gnu/packages/python-web.scm                   | 11 +++-
 3 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/python-w3lib-fix-test-failure.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index aac7362475..6ac1ceb147 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1592,6 +1592,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python-chai-drop-python2.patch		\
   %D%/packages/patches/python-random2-getrandbits-test.patch		\
   %D%/packages/patches/python-poppler-qt5-fix-build.patch	\
+  %D%/packages/patches/python-w3lib-fix-test-failure.patch	\
   %D%/packages/patches/sdcc-disable-non-free-code.patch		\
   %D%/packages/patches/sdl-pango-api_additions.patch		\
   %D%/packages/patches/sdl-pango-blit_overflow.patch		\
diff --git a/gnu/packages/patches/python-w3lib-fix-test-failure.patch b/gnu/packages/patches/python-w3lib-fix-test-failure.patch
new file mode 100644
index 0000000000..f38fc749df
--- /dev/null
+++ b/gnu/packages/patches/python-w3lib-fix-test-failure.patch
@@ -0,0 +1,60 @@
+From fae6cc40e112cd13697cb0e8d79976f32c72491d Mon Sep 17 00:00:00 2001
+From: Eugenio Lacuesta <eugenio.lacuesta <at> gmail.com>
+Date: Wed, 10 Mar 2021 12:31:05 -0300
+Subject: [PATCH] [CI] Mark single add_or_replace_parameter test as xfail
+
+---
+This patch is based on upstream commit
+fae6cc40e112cd13697cb0e8d79976f32c72491d which is part of
+https://github.com/scrapy/w3lib/pull/166.
+
+ .gitignore        |  3 ++-
+ tests/test_url.py | 25 ++++++++++++++-----------
+ 2 files changed, 16 insertions(+), 12 deletions(-)
+
+diff --git a/tests/test_url.py b/tests/test_url.py
+index 8b07c00..0f7458e 100644
+--- a/tests/test_url.py
++++ b/tests/test_url.py
+@@ -1,12 +1,14 @@
+-# -*- coding: utf-8 -*-
+ from __future__ import absolute_import
+ import os
+ import unittest
++
++import pytest
++from six.moves.urllib.parse import urlparse
++
+ from w3lib.url import (is_url, safe_url_string, safe_download_url,
+     url_query_parameter, add_or_replace_parameter, url_query_cleaner,
+     file_uri_to_path, parse_data_uri, path_to_file_uri, any_to_uri,
+     urljoin_rfc, canonicalize_url, parse_url, add_or_replace_parameters)
+-from six.moves.urllib.parse import urlparse
+ 
+ 
+ class UrlTests(unittest.TestCase):
+@@ -310,10 +311,6 @@ def test_add_or_replace_parameter(self):
+         self.assertEqual(add_or_replace_parameter(url, 'arg3', 'nv3'),
+                          'http://domain/test?arg1=v1&arg2=v2&arg3=nv3')
+ 
+-        url = 'http://domain/test?arg1=v1;arg2=v2'
+-        self.assertEqual(add_or_replace_parameter(url, 'arg1', 'v3'),
+-                         'http://domain/test?arg1=v3&arg2=v2')
+-
+         self.assertEqual(add_or_replace_parameter("http://domain/moreInfo.asp?prodID=", 'prodID', '20'),
+                          'http://domain/moreInfo.asp?prodID=20')
+         url = 'http://rmc-offers.co.uk/productlist.asp?BCat=2%2C60&CatID=60'
+@@ -338,6 +335,13 @@ def test_add_or_replace_parameter(self):
+         self.assertEqual(add_or_replace_parameter(url, 'arg1', 'v3'),
+                          'http://domain/test?arg1=v3&arg2=v2')
+ 
++    @pytest.mark.xfail(reason="https://github.com/scrapy/w3lib/issues/164")
++    def test_add_or_replace_parameter_fail(self):
++        self.assertEqual(
++            add_or_replace_parameter('http://domain/test?arg1=v1;arg2=v2', 'arg1', 'v3'),
++            'http://domain/test?arg1=v3&arg2=v2'
++        )
++
+     def test_add_or_replace_parameters(self):
+         url = 'http://domain/test'
+         self.assertEqual(add_or_replace_parameters(url, {'arg': 'v'}),
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 41e0d1c3d6..f77d163833 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -49,6 +49,7 @@
 ;;; Copyright © 2021 Alice Brenon <alice.brenon <at> ens-lyon.fr>
 ;;; Copyright © 2022 John Kehayias <john.kehayias <at> protonmail.com>
 ;;; Copyright © 2022 Denis 'GNUtoo' Carikli <GNUtoo <at> cyberdimension.org>
+;;; Copyright © 2022 Felix Gruber <felgru <at> posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -6188,12 +6189,20 @@ communicate with Microsoft Azure Storage services.")
      (origin
        (method url-fetch)
        (uri (pypi-uri "w3lib" version))
+       (patches (search-patches "python-w3lib-fix-test-failure.patch"))
        (sha256
         (base32
          "1pv02lvvmgz2qb61vz1jkjc04fgm4hpfvaj5zm4i3mjp64hd1mha"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+        (modify-phases %standard-phases
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (invoke "pytest")))))))
     (native-inputs
-     (list python-six))
+     (list python-pytest python-six))
     (home-page "https://github.com/scrapy/w3lib")
     (synopsis "Python library of web-related functions")
     (description
-- 
2.30.2





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 05 Apr 2022 18:27:01 GMT) Full text and rfc822 format available.

Notification sent to Felix Gruber <felgru <at> posteo.net>:
bug acknowledged by developer. (Tue, 05 Apr 2022 18:27:01 GMT) Full text and rfc822 format available.

Message #10 received at 54697-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Felix Gruber <felgru <at> posteo.net>
Cc: 54697-done <at> debbugs.gnu.org
Subject: Re: bug#54697: [PATCH] gnu: python-w3lib: Fix build.
Date: Tue, 05 Apr 2022 20:26:32 +0200
Hi,

Felix Gruber <felgru <at> posteo.net> skribis:

> * gnu/packages/python-web.scm (python-w3lib): Fix build.
>   [source]: Add python-w3lib-fix-test-failure.patch.
>   [arguments]: Use pytest in the 'check phase.
>   [native-inputs]: Add python-pytest.
> * gnu/packages/patches/python-w3lib-fix-test-failure.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 May 2022 11:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 49 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.