From 6046665629bc28250f4983756fa25957ace280b714f0e57d4eaac5f35f24f6b0 Mon Sep 17 00:00:00 2001 From: Todd R Date: Thu, 5 Sep 2019 15:48:43 +0000 Subject: [PATCH] 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 --- MechanicalSoup-0.11.0.tar.gz | 3 - MechanicalSoup-0.12.0.tar.gz | 3 + bs4-47.patch | 123 ---------------------------------- python-MechanicalSoup.changes | 27 ++++++++ python-MechanicalSoup.spec | 8 ++- 5 files changed, 35 insertions(+), 129 deletions(-) delete mode 100644 MechanicalSoup-0.11.0.tar.gz create mode 100644 MechanicalSoup-0.12.0.tar.gz delete mode 100644 bs4-47.patch diff --git a/MechanicalSoup-0.11.0.tar.gz b/MechanicalSoup-0.11.0.tar.gz deleted file mode 100644 index 942eced..0000000 --- a/MechanicalSoup-0.11.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2712ec0f3087cbc719c6c3dfb317a05800ff14fcdbfa67a2f9f6e07226e7a94c -size 43088 diff --git a/MechanicalSoup-0.12.0.tar.gz b/MechanicalSoup-0.12.0.tar.gz new file mode 100644 index 0000000..786e9aa --- /dev/null +++ b/MechanicalSoup-0.12.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:39a60627a97981869251837b8bd082485f2f681df8a3315836ffaa74663627bd +size 44505 diff --git a/bs4-47.patch b/bs4-47.patch deleted file mode 100644 index e7f8907..0000000 --- a/bs4-47.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 6c5408b123c9260e3debd63f3cb78c6634b9d4fa Mon Sep 17 00:00:00 2001 -From: Dan Hemberger -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) diff --git a/python-MechanicalSoup.changes b/python-MechanicalSoup.changes index 1691dae..a062a32 100644 --- a/python-MechanicalSoup.changes +++ b/python-MechanicalSoup.changes @@ -1,3 +1,30 @@ +------------------------------------------------------------------- +Thu Sep 5 15:01:16 UTC 2019 - Todd R + +- 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. + * ``