[Python-modules-team] Bug#922833: lxml breaks python-mechanicalsoup autopkgtest
Julian Andres Klode
jak at debian.org
Mon Mar 4 12:30:54 GMT 2019
Package: python-mechanicalsoup
Followup-For: Bug #922833
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu disco ubuntu-patch
In Ubuntu, the attached patch was applied to achieve the following:
* Fix tests to use https for httpbin
* Do not expect a Connection header in test_submit_online()
Thanks for considering the patch.
-- System Information:
Debian Release: buster/sid
APT prefers disco
APT policy: (991, 'disco'), (500, 'disco'), (500, 'cosmic-security')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.19.0-13-generic (SMP w/8 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer i speak de, en
-------------- next part --------------
diff -Nru python-mechanicalsoup-0.10.0/debian/patches/https-httpbin python-mechanicalsoup-0.10.0/debian/patches/https-httpbin
--- python-mechanicalsoup-0.10.0/debian/patches/https-httpbin 1970-01-01 01:00:00.000000000 +0100
+++ python-mechanicalsoup-0.10.0/debian/patches/https-httpbin 2019-03-04 11:20:03.000000000 +0100
@@ -0,0 +1,104 @@
+Description: Fix httpbin tests to use https
+ This is needed because httpbin now does https redirects and the
+ tests fail.
+Author: Julian Andres Klode <juliank at ubuntu.com>
+Last-Update: 2019-03-04
+
+--- python-mechanicalsoup-0.10.0.orig/tests/test_browser.py
++++ python-mechanicalsoup-0.10.0/tests/test_browser.py
+@@ -8,7 +8,7 @@ import pytest
+
+
+ def test_submit_online(httpbin):
+- """Complete and submit the pizza form at http://httpbin.org/forms/post """
++ """Complete and submit the pizza form at https://httpbin.org/forms/post """
+ browser = mechanicalsoup.Browser()
+ page = browser.get(httpbin + "/forms/post")
+ form = page.soup.form
+@@ -23,7 +23,7 @@ def test_submit_online(httpbin):
+
+ response = browser.submit(form, page.url)
+
+- # helpfully the form submits to http://httpbin.org/post which simply
++ # helpfully the form submits to https://httpbin.org/post which simply
+ # returns the request headers in json format
+ json = response.json()
+ data = json["form"]
+@@ -38,7 +38,7 @@ def test_submit_online(httpbin):
+
+
+ form_html = """
+-<form method="post" action="http://httpbin.org/post">
++<form method="post" action="https://httpbin.org/post">
+ <input name="customer" value="Philip J. Fry"/>
+ <input name="telephone" value="555"/>
+ <textarea name="comments">freezer</textarea>
+--- python-mechanicalsoup-0.10.0.orig/tests/test_form.py
++++ python-mechanicalsoup-0.10.0/tests/test_form.py
+@@ -6,7 +6,7 @@ import pytest
+
+
+ def test_submit_online(httpbin):
+- """Complete and submit the pizza form at http://httpbin.org/forms/post """
++ """Complete and submit the pizza form at https://httpbin.org/forms/post """
+ browser = mechanicalsoup.Browser()
+ page = browser.get(httpbin + "/forms/post")
+ form = mechanicalsoup.Form(page.soup.form)
+@@ -25,7 +25,7 @@ def test_submit_online(httpbin):
+
+ response = browser.submit(form, page.url)
+
+- # helpfully the form submits to http://httpbin.org/post which simply
++ # helpfully the form submits to https://httpbin.org/post which simply
+ # returns the request headers in json format
+ json = response.json()
+ data = json["form"]
+@@ -37,7 +37,7 @@ def test_submit_online(httpbin):
+
+
+ def test_submit_set(httpbin):
+- """Complete and submit the pizza form at http://httpbin.org/forms/post """
++ """Complete and submit the pizza form at https://httpbin.org/forms/post """
+ browser = mechanicalsoup.Browser()
+ page = browser.get(httpbin + "/forms/post")
+ form = mechanicalsoup.Form(page.soup.form)
+@@ -51,7 +51,7 @@ def test_submit_set(httpbin):
+
+ response = browser.submit(form, page.url)
+
+- # helpfully the form submits to http://httpbin.org/post which simply
++ # helpfully the form submits to https://httpbin.org/post which simply
+ # returns the request headers in json format
+ json = response.json()
+ data = json["form"]
+--- python-mechanicalsoup-0.10.0.orig/tests/test_stateful_browser.py
++++ python-mechanicalsoup-0.10.0/tests/test_stateful_browser.py
+@@ -25,7 +25,7 @@ def test_request_forward():
+
+
+ def test_submit_online(httpbin):
+- """Complete and submit the pizza form at http://httpbin.org/forms/post """
++ """Complete and submit the pizza form at https://httpbin.org/forms/post """
+ browser = mechanicalsoup.StatefulBrowser()
+ browser.set_user_agent('testing MechanicalSoup')
+ browser.open(httpbin.url)
+@@ -217,7 +217,7 @@ def test_verbose(capsys):
+
+ def test_new_control():
+ browser = mechanicalsoup.StatefulBrowser()
+- browser.open("http://httpbin.org/forms/post")
++ browser.open("https://httpbin.org/forms/post")
+ browser.select_form("form")
+ with pytest.raises(mechanicalsoup.LinkNotFoundError):
+ # The control doesn't exist, yet.
+--- python-mechanicalsoup-0.10.0.orig/tests/utils.py
++++ python-mechanicalsoup-0.10.0/tests/utils.py
+@@ -72,7 +72,7 @@ class HttpbinRemote:
+ """Drop-in replacement for pytest-httpbin's httpbin fixture
+ that uses the remote httpbin server instead of a local one."""
+ def __init__(self):
+- self.url = "http://httpbin.org"
++ self.url = "https://httpbin.org"
+
+ def __add__(self, x):
+ return self.url + x
diff -Nru python-mechanicalsoup-0.10.0/debian/patches/no-connection-header.patch python-mechanicalsoup-0.10.0/debian/patches/no-connection-header.patch
--- python-mechanicalsoup-0.10.0/debian/patches/no-connection-header.patch 1970-01-01 01:00:00.000000000 +0100
+++ python-mechanicalsoup-0.10.0/debian/patches/no-connection-header.patch 2019-03-04 11:20:40.000000000 +0100
@@ -0,0 +1,16 @@
+Description: Do not expect Connection header
+ That header seems to be gone from the json.
+Author: Julian Andres Klode <juliank at ubuntu.com>
+Last-Update: 2019-03-04
+
+--- python-mechanicalsoup-0.10.0.orig/tests/test_stateful_browser.py
++++ python-mechanicalsoup-0.10.0/tests/test_stateful_browser.py
+@@ -55,7 +55,7 @@ def test_submit_online(httpbin):
+
+ assert json["headers"]["User-Agent"] == 'testing MechanicalSoup'
+ # Ensure we haven't blown away any regular headers
+- expected_headers = ('Content-Length', 'Host', 'Content-Type', 'Connection',
++ expected_headers = ('Content-Length', 'Host', 'Content-Type',
+ 'Accept', 'User-Agent', 'Accept-Encoding')
+ assert set(expected_headers).issubset(json["headers"].keys())
+
diff -Nru python-mechanicalsoup-0.10.0/debian/patches/series python-mechanicalsoup-0.10.0/debian/patches/series
--- python-mechanicalsoup-0.10.0/debian/patches/series 2018-06-22 19:05:28.000000000 +0200
+++ python-mechanicalsoup-0.10.0/debian/patches/series 2019-03-04 11:20:40.000000000 +0100
@@ -1,2 +1,4 @@
No-pytest-runner.patch
06f32ba21d1de71e274e52f1491c6da80200b461.patch
+https-httpbin
+no-connection-header.patch
More information about the Python-modules-team
mailing list