Hello community,
here is the log from the commit of package python-MechanicalSoup for
openSUSE:Factory checked in at 2019-03-12 09:52:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-MechanicalSoup (Old)
and /work/SRC/openSUSE:Factory/.python-MechanicalSoup.new.28833 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-MechanicalSoup"
Tue Mar 12 09:52:15 2019 rev:4 rq:681856 version:0.11.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-MechanicalSoup/python-MechanicalSoup.changes
2019-01-24 14:02:33.576110082 +0100
+++
/work/SRC/openSUSE:Factory/.python-MechanicalSoup.new.28833/python-MechanicalSoup.changes
2019-03-12 09:52:21.279550740 +0100
@@ -1,0 +2,16 @@
+Tue Mar 5 16:57:10 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Add patch to work with beautifulsoup4-4.7+:
+ * bs4-47.patch
+
+-------------------------------------------------------------------
+Tue Mar 5 16:49:39 UTC 2019 - Tomáš Chvátal <[email protected]>
+
+- Update to 0.11.0:
+ * Constructing a Form instance from a bs4.element.Tag whose tag name is not
form will now emit a warning, and may be deprecated in the future. [#228]
+ * Breaking Change: LinkNotFoundError now derives from Exception instead of
BaseException. While this will bring the behavior in line with most people's
expectations, it may affect the behavior of your code if you were heavily
relying on this implementation detail in your exception handling. [#203]
+ * Improve handling of button submit elements. Will now correctly ignore
buttons of type button and reset during form submission, since they are not
considered to be submit elements. [#199]
+ * Do a better job of inferring the content type of a response if the
Content-Type header is not provided. [#195]
+ * Improve consistency of query string construction between MechanicalSoup
and web browsers in edge cases where form elements have duplicate name
attributes. This prevents errors in valid use cases, and also makes
MechanicalSoup more tolerant of invalid HTML. [#158]
+
+-------------------------------------------------------------------
Old:
----
MechanicalSoup-0.10.0.tar.gz
New:
----
MechanicalSoup-0.11.0.tar.gz
bs4-47.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-MechanicalSoup.spec ++++++
--- /var/tmp/diff_new_pack.cqerR0/_old 2019-03-12 09:52:22.755550445 +0100
+++ /var/tmp/diff_new_pack.cqerR0/_new 2019-03-12 09:52:22.759550444 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-MechanicalSoup
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,33 +17,31 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
-# Tests require network connection
-%bcond_with test
Name: python-MechanicalSoup
-Version: 0.10.0
+Version: 0.11.0
Release: 0
Summary: A Python library for automating interaction with websites
License: MIT
Group: Development/Languages/Python
-Url: https://github.com/hickford/MechanicalSoup
+URL: https://github.com/hickford/MechanicalSoup
Source:
https://files.pythonhosted.org/packages/source/M/MechanicalSoup/MechanicalSoup-%{version}.tar.gz
-BuildRequires: %{python_module pytest-runner}
-BuildRequires: %{python_module setuptools}
-BuildRequires: fdupes
-BuildRequires: python-rpm-macros
-%if %{with test}
-BuildRequires: %{python_module beautifulsoup4}
-BuildRequires: %{python_module pytest-cov}
+Patch0: bs4-47.patch
+BuildRequires: %{python_module beautifulsoup4 >= 4.4}
+BuildRequires: %{python_module lxml}
+BuildRequires: %{python_module pytest-httpbin}
+BuildRequires: %{python_module pytest-mock}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requests >= 2.0}
BuildRequires: %{python_module requests-mock}
+BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module six >= 1.4}
-%endif
-Requires: python-beautifulsoup4
+BuildRequires: fdupes
+BuildRequires: python-rpm-macros
+Requires: python-beautifulsoup4 >= 4.4
+Requires: python-lxml
Requires: python-requests >= 2.0
Requires: python-six >= 1.4
BuildArch: noarch
-
%python_subpackages
%description
@@ -59,6 +57,9 @@
%prep
%setup -q -n MechanicalSoup-%{version}
+%patch0 -p1
+# do not require cov/xdist/etc
+sed -i -e '/addopts/d' setup.cfg
%build
%python_build
@@ -67,13 +68,10 @@
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
-%if %{with test}
%check
-%python_exec setup.py test
-%endif
+%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib}
py.test-%{$python_bin_suffix} -v
%files %{python_files}
-%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%{python_sitelib}/*
++++++ MechanicalSoup-0.10.0.tar.gz -> MechanicalSoup-0.11.0.tar.gz ++++++
++++ 2493 lines of diff (skipped)
++++++ bs4-47.patch ++++++
>From 6c5408b123c9260e3debd63f3cb78c6634b9d4fa Mon Sep 17 00:00:00 2001
From: Dan Hemberger <[email protected]>
Date: Thu, 17 Jan 2019 10:58:10 -0800
Subject: [PATCH] Fix tests for bs4 4.7.0+
CSS selectors in bs4 now return elements in page order, whereas
they did not previously.
This requires us to re-order some of our expected test output,
and to perform an order-independent comparison if tested with
a bs4 version before 4.7.0.
Tested and passing with bs4 4.6.0 and 4.7.1.
Closes #257.
---
tests/test_form.py | 12 ++++++------
tests/test_stateful_browser.py | 10 +++++-----
tests/utils.py | 9 ++++++++-
3 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/tests/test_form.py b/tests/test_form.py
index 8db2042..32d6463 100644
--- a/tests/test_form.py
+++ b/tests/test_form.py
@@ -74,30 +74,30 @@ def test_submit_set(httpbin):
@pytest.mark.parametrize("expected_post", [
pytest.param(
[
+ ('text', 'Setting some text!'),
('comment', 'Testing preview page'),
('preview', 'Preview Page'),
- ('text', 'Setting some text!')
], id='preview'),
pytest.param(
[
+ ('text', '= Heading =\n\nNew page here!\n'),
('comment', 'Created new page'),
('save', 'Submit changes'),
- ('text', '= Heading =\n\nNew page here!\n')
], id='save'),
pytest.param(
[
+ ('text', '= Heading =\n\nNew page here!\n'),
('comment', 'Testing choosing cancel button'),
('cancel', 'Cancel'),
- ('text', '= Heading =\n\nNew page here!\n')
], id='cancel'),
])
def test_choose_submit(expected_post):
browser, url = setup_mock_browser(expected_post=expected_post)
browser.open(url)
form = browser.select_form('#choose-submit-form')
- browser['text'] = expected_post[2][1]
- browser['comment'] = expected_post[0][1]
- form.choose_submit(expected_post[1][0])
+ browser['text'] = dict(expected_post)['text']
+ browser['comment'] = dict(expected_post)['comment']
+ form.choose_submit(expected_post[2][0])
res = browser.submit_selected()
assert(res.status_code == 200 and res.text == 'Success!')
diff --git a/tests/test_stateful_browser.py b/tests/test_stateful_browser.py
index 291bec2..5c5876a 100644
--- a/tests/test_stateful_browser.py
+++ b/tests/test_stateful_browser.py
@@ -125,15 +125,15 @@ def test_links():
@pytest.mark.parametrize("expected_post", [
pytest.param(
[
+ ('text', 'Setting some text!'),
('comment', 'Selecting an input submit'),
('diff', 'Review Changes'),
- ('text', 'Setting some text!')
], id='input'),
pytest.param(
[
+ ('text', '= Heading =\n\nNew page here!\n'),
('comment', 'Selecting a button submit'),
('cancel', 'Cancel'),
- ('text', '= Heading =\n\nNew page here!\n')
], id='button'),
])
def test_submit_btnName(expected_post):
@@ -141,9 +141,9 @@ def test_submit_btnName(expected_post):
browser, url = setup_mock_browser(expected_post=expected_post)
browser.open(url)
browser.select_form('#choose-submit-form')
- browser['text'] = expected_post[2][1]
- browser['comment'] = expected_post[0][1]
- res = browser.submit_selected(btnName=expected_post[1][0])
+ browser['text'] = dict(expected_post)['text']
+ browser['comment'] = dict(expected_post)['comment']
+ res = browser.submit_selected(btnName=expected_post[2][0])
assert(res.status_code == 200 and res.text == 'Success!')
diff --git a/tests/utils.py b/tests/utils.py
index 25f8ea4..3d4a72b 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -1,5 +1,7 @@
import mechanicalsoup
import requests_mock
+from distutils.version import StrictVersion
+import bs4
try:
from urllib.parse import parse_qsl
except ImportError:
@@ -62,7 +64,12 @@ def mock_post(mocked_adapter, url, expected,
reply='Success!'):
def text_callback(request, context):
# Python 2's parse_qsl doesn't like None argument
query = parse_qsl(request.text) if request.text else []
- assert (query == expected)
+ # In bs4 4.7.0+, CSS selectors return elements in page order,
+ # but did not in earlier versions.
+ if StrictVersion(bs4.__version__) >= StrictVersion('4.7.0'):
+ assert query == expected
+ else:
+ assert sorted(query) == sorted(expected)
return reply
mocked_adapter.register_uri('POST', url, text=text_callback)