forked from pool/python-MechanicalSoup
Accepting request 728549 from home:TheBlackCat:branches:devel:languages:python
Update to 0.12.0 OBS-URL: https://build.opensuse.org/request/show/728549 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-MechanicalSoup?expand=0&rev=9
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2712ec0f3087cbc719c6c3dfb317a05800ff14fcdbfa67a2f9f6e07226e7a94c
|
||||
size 43088
|
||||
3
MechanicalSoup-0.12.0.tar.gz
Normal file
3
MechanicalSoup-0.12.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:39a60627a97981869251837b8bd082485f2f681df8a3315836ffaa74663627bd
|
||||
size 44505
|
||||
123
bs4-47.patch
123
bs4-47.patch
@@ -1,123 +0,0 @@
|
||||
From 6c5408b123c9260e3debd63f3cb78c6634b9d4fa Mon Sep 17 00:00:00 2001
|
||||
From: Dan Hemberger <daniel.hemberger@gmail.com>
|
||||
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)
|
||||
@@ -1,3 +1,30 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 5 15:01:16 UTC 2019 - Todd R <toddrme2178@gmail.com>
|
||||
|
||||
- Update to 0.12.0:
|
||||
+ Main changes:
|
||||
* Changes in official python version support: added 3.7 and dropped 3.4.
|
||||
* Added ability to submit a form without updating ``StatefulBrowser`` internal
|
||||
state: ``submit_selected(..., update_state=False)``. This means you get a
|
||||
response from the form submission, but your browser stays on the same page.
|
||||
Useful for handling forms that result in a file download or open a new tab.
|
||||
+ Bug fixes
|
||||
* Improve handling of form enctype to behave like a real browser.
|
||||
* HTML ``type`` attributes are no longer required to be lowercase.
|
||||
* Form controls with the ``disabled`` attribute will no longer be submitted
|
||||
to improve compliance with the HTML standard. If you were relying on this
|
||||
bug to submit disabled elements, you can still achieve this by deleting the
|
||||
``disabled`` attribute from the element in the :class:`~mechanicalsoup.Form`
|
||||
object directly.
|
||||
* When a form containing a file input field is submitted without choosing a
|
||||
file, an empty filename & content will be sent just like in a real browser.
|
||||
* ``<option>`` tags without a ``value`` attribute will now use their text as
|
||||
the value.
|
||||
* The optional ``url_regex`` argument to ``follow_link`` and ``download_link``
|
||||
was fixed so that it is no longer ignored.
|
||||
* Allow duplicate submit elements instead of raising a LinkNotFoundError.
|
||||
- Drop upstream-included bs4-47.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 5 16:57:10 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
|
||||
@@ -18,15 +18,16 @@
|
||||
|
||||
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
|
||||
Name: python-MechanicalSoup
|
||||
Version: 0.11.0
|
||||
Version: 0.12.0
|
||||
Release: 0
|
||||
Summary: A Python library for automating interaction with websites
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://github.com/hickford/MechanicalSoup
|
||||
Source: https://files.pythonhosted.org/packages/source/M/MechanicalSoup/MechanicalSoup-%{version}.tar.gz
|
||||
Patch0: bs4-47.patch
|
||||
BuildRequires: %{python_module beautifulsoup4 >= 4.4}
|
||||
BuildRequires: %{python_module httpbin}
|
||||
BuildRequires: %{python_module jsonschema >= 2.5.1}
|
||||
BuildRequires: %{python_module lxml}
|
||||
BuildRequires: %{python_module pytest-httpbin}
|
||||
BuildRequires: %{python_module pytest-mock}
|
||||
@@ -41,6 +42,8 @@ Requires: python-beautifulsoup4 >= 4.4
|
||||
Requires: python-lxml
|
||||
Requires: python-requests >= 2.0
|
||||
Requires: python-six >= 1.4
|
||||
Recommends: python-httpbin
|
||||
Recommends: python-jsonschema >= 2.5.1
|
||||
BuildArch: noarch
|
||||
%python_subpackages
|
||||
|
||||
@@ -57,7 +60,6 @@ document navigation).
|
||||
|
||||
%prep
|
||||
%setup -q -n MechanicalSoup-%{version}
|
||||
%patch0 -p1
|
||||
# do not require cov/xdist/etc
|
||||
sed -i -e '/addopts/d' setup.cfg
|
||||
|
||||
|
||||
Reference in New Issue
Block a user