lists.wikimedia.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
List overview
Download
Pywikibot-commits
----- 2024 -----
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
pywikibot-commits@lists.wikimedia.org
1 participants
13497 discussions
Start a n
N
ew thread
[Gerrit] ...core[master]: [tests] Add write_tests action
by Xqt (Code Review)
30 Apr '23
30 Apr '23
Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913653
) Change subject: [tests] Add write_tests action ...................................................................... [tests] Add write_tests action Change-Id: I6b6abaaa20787002f095eaa3f52ecfbfc3eef960 --- A .github/workflows/write_tests-ci.yml 1 file changed, 94 insertions(+), 0 deletions(-) Approvals: Xqt: Verified; Looks good to me, approved diff --git a/.github/workflows/write_tests-ci.yml b/.github/workflows/write_tests-ci.yml new file mode 100644 index 0000000..9aa1d4e --- /dev/null +++ b/.github/workflows/write_tests-ci.yml @@ -0,0 +1,85 @@ +name: Pywikibot CI +# Run Pywikibot tests with a variety of Python versions + +on: + push: + branches: [ master, stable ] + pull_request: + branches: [ master ] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + PYWIKIBOT_TEST_RUNNING: 1 + PYWIKIBOT_USERNAME: Pywikibot-test + +jobs: + build: + runs-on: 'ubuntu-latest' + continue-on-error: ${{ matrix.experimental || false }} + timeout-minutes: 120 + + strategy: + fail-fast: false + max-parallel: 16 + + matrix: + python-version: ["3.7"] + site: ['wikipedia:test'] + experimental: [true] + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip --version + pip install -U setuptools + if [ -f dev-requirements.txt ]; then pip install -r dev-requirements.txt; fi + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + python -c "import setuptools; print('setuptools:', setuptools.__version__)" + + - name: Generate user files + run: | + python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; + echo "usernames['wikipedia']['en'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "usernames['wikisource']['zh'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "usernames['wikipedia']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "usernames['wikidata']['test'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "usernames['commons']['commons'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "usernames['meta']['meta'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "max_retries = 3" >> user-config.py + echo "noisysleep = float('inf')" >> user-config.py + echo "maximum_GET_length = 5000" >> user-config.py + echo "console_encoding = 'utf8'" >> user-config.py + echo "import os" >> user-config.py + echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py + echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PYWIKIBOT_USERPWD }}')" > passwordfile + + - name: Test with unittest or pytest + id: ci_test + continue-on-error: true + timeout-minutes: 90 + env: + PYWIKIBOT_TEST_WRITE: ${{ matrix.site == 'wikipedia:test' && 1 || 0}} + run: | + python pwb.py version + pytest --cov=.; -a 'write' + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + + - name: Check on failure + if: steps.ci_test.outcome == 'failure' + run: exit 1 -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913653
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I6b6abaaa20787002f095eaa3f52ecfbfc3eef960 Gerrit-Change-Number: 913653 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] Update coverage for tests
by jenkins-bot (Code Review)
30 Apr '23
30 Apr '23
jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913605
) Change subject: [tests] Update coverage for tests ...................................................................... [tests] Update coverage for tests Change-Id: Ifaaf309ddd14d30f8ec1d8353c8f47d7a720afc1 --- M tests/site_login_logout_tests.py M tests/proofreadpage_tests.py M tests/time_tests.py M tests/site_generators_tests.py M tests/page_tests.py M tests/paraminfo_tests.py M tests/logentries_tests.py M tests/eventstreams_tests.py M tests/api_tests.py 9 files changed, 44 insertions(+), 37 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/api_tests.py b/tests/api_tests.py index 56580d4..783e1b5 100755 --- a/tests/api_tests.py +++ b/tests/api_tests.py @@ -982,7 +982,7 @@ req.submit() except SystemExit: pass # expected exception from DummyThrottle instance - except APIError as e: + except APIError as e: # pragma: no cover pywikibot.warning( 'Wrong api lagpattern regex, cannot retrieve lag value') raise e diff --git a/tests/eventstreams_tests.py b/tests/eventstreams_tests.py index 65dc347..a5762ec 100755 --- a/tests/eventstreams_tests.py +++ b/tests/eventstreams_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Tests for the eventstreams module.""" # -# (C) Pywikibot team, 2017-2022 +# (C) Pywikibot team, 2017-2023 # # Distributed under the terms of the MIT license. # @@ -280,7 +280,7 @@ n += 1 try: element = json.loads(event.data) - except ValueError as e: + except ValueError as e: # pragma: no cover self.source.resp.close() # close SSLSocket del self.source raise ValueError( diff --git a/tests/logentries_tests.py b/tests/logentries_tests.py index 6d21d45..1270738 100755 --- a/tests/logentries_tests.py +++ b/tests/logentries_tests.py @@ -88,12 +88,12 @@ self.assertIsInstance(logentry.comment(), str) self.assertIsInstance(logentry.user(), str) self.assertEqual(logentry.user(), logentry['user']) - except HiddenKeyError as e: + except HiddenKeyError as e: # pragma: no cover self.assertRegex( str(e), r"Log entry \([^)]+\) has a hidden '\w+' key and you " r"don't have permission to view it") - except KeyError as e: + except KeyError as e: # pragma: no cover self.assertRegex(str(e), "Log entry ([^)]+) has no 'comment' key") else: self.assertEqual(logentry.comment(), logentry['comment']) @@ -120,7 +120,7 @@ self.assertIsInstance(logentry.page(), pywikibot.FilePage) else: self.assertIsInstance(logentry.page(), pywikibot.Page) - else: + else: # pragma: no cover with self.assertRaises(KeyError): logentry.page() @@ -179,13 +179,13 @@ - set(LogEntryFactory._logtypes)): if not simple_type: # paraminfo also reports an empty string as a type - continue + continue # pragma: no cover try: self._test_logevent(simple_type) - except StopIteration: + except StopIteration: # pragma: no cover unittest_print( - 'Unable to test "{}" on "{}" because there are no log ' - 'entries with that type.'.format(simple_type, key)) + f'Unable to test "{simple_type}" on "{key}" because there' + ' are no log entries with that type.') class TestLogentryParams(TestLogentriesBase): diff --git a/tests/page_tests.py b/tests/page_tests.py index 795f437..6e92e99 100755 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Tests for the page module.""" # -# (C) Pywikibot team, 2008-2022 +# (C) Pywikibot team, 2008-2023 # # Distributed under the terms of the MIT license. # @@ -198,7 +198,7 @@ p1 = pywikibot.Page(site, 'Help:Test page#Testing') ns_name = 'Help' if site.namespaces[12][0] != ns_name: - ns_name = site.namespaces[12][0] + ns_name = site.namespaces[12][0] # pragma: no cover self.assertEqual(p1.title(), ns_name + ':Test page#Testing') self.assertEqual(p1.title(underscore=True), ns_name + ':Test_page#Testing') @@ -232,7 +232,7 @@ p2 = pywikibot.Page(site, 'File:Jean-Léon Gérôme 003.jpg') ns_name = 'File' if site.namespaces[6][0] != ns_name: - ns_name = site.namespaces[6][0] + ns_name = site.namespaces[6][0] # pragma: no cover self.assertEqual(p2.title(), 'File:Jean-Léon Gérôme 003.jpg') self.assertEqual(p2.title(underscore=True), 'File:Jean-Léon_Gérôme_003.jpg') diff --git a/tests/paraminfo_tests.py b/tests/paraminfo_tests.py index 78a329d..13d67afd 100755 --- a/tests/paraminfo_tests.py +++ b/tests/paraminfo_tests.py @@ -49,7 +49,7 @@ values = self._get_param_values(site, module, parameter) exp = set(expected) val = set(values) - if not exp.issuperset(val): + if not exp.issuperset(val): # pragma: no cover diff = val - exp self.fail('Unexpected param{} {} in values' .format('s' if len(diff) > 1 else '', diff)) diff --git a/tests/proofreadpage_tests.py b/tests/proofreadpage_tests.py index f05fc54..40a1728 100755 --- a/tests/proofreadpage_tests.py +++ b/tests/proofreadpage_tests.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """Tests for the proofreadpage module.""" # -# (C) Pywikibot team, 2015-2022 +# (C) Pywikibot team, 2015-2023 # # Distributed under the terms of the MIT license. # @@ -392,11 +392,10 @@ total=1, **rvargs) rvgen.set_maximum_items(-1) # suppress use of rvlimit parameter - try: + loaded_text = '' + with suppress(LookupError, StopIteration, TypeError, ValueError): pagedict = next(rvgen) loaded_text = pagedict.get('revisions')[0].get('*') - except (StopIteration, TypeError, KeyError, ValueError, IndexError): - loaded_text = '' page_text = page._page_to_json() self.assertEqual(json.loads(page_text), json.loads(loaded_text)) diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py index 388d7e5..fe2572a 100755 --- a/tests/site_generators_tests.py +++ b/tests/site_generators_tests.py @@ -312,11 +312,10 @@ for page in mysite.allpages(maxsize=200, total=5): self.assertIsInstance(page, pywikibot.Page) self.assertTrue(page.exists()) - if (len(page.text.encode(mysite.encoding())) > 200 - and mysite.data_repository() == mysite): + if len(page.text.encode(mysite.encoding())) > 200 \ + and mysite.data_repository() == mysite: # pragma: no cover unittest_print( - '{}.text is > 200 bytes while raw JSON is <= 200' - .format(page)) + f'{page}.text is > 200 bytes while raw JSON is <= 200') continue self.assertLessEqual(len(page.text.encode(mysite.encoding())), 200) @@ -724,7 +723,8 @@ self.assertIn('editcount', user) self.assertIn('registration', user) - def _test_allusers_with_group(self): + @unittest.expectedFailure + def test_allusers_with_group(self): """Test the site.allusers(group=..) method.""" mysite = self.get_site() for user in mysite.allusers(prefix='D', group='bot', total=5): @@ -800,10 +800,10 @@ imagepage = self.imagepage for using in mysite.imageusage(imagepage, filterredir=False, total=5): self.assertIsInstance(using, pywikibot.Page) - if using.isRedirectPage(): + if using.isRedirectPage(): # pragma: no cover unittest_print( - '{} is a redirect, although just non-redirects were ' - 'searched. See also T75120'.format(using)) + f'{using} is a redirect, although just non-redirects were' + ' searched. See also T75120') self.assertFalse(using.isRedirectPage()) @@ -827,8 +827,8 @@ entry = next(gen) except StopIteration: break - except HiddenKeyError as e: # T216876 - self.skipTest(e) + except HiddenKeyError as e: # pragma: no cover + self.skipTest(e) # T216876 else: self.assertEqual(entry.type(), logtype) @@ -1094,13 +1094,12 @@ for hit in mysite.search('wiki', namespaces=0, total=10): self.assertIsInstance(hit, pywikibot.Page) self.assertEqual(hit.namespace(), 0) - except APIError as e: + except APIError as e: # pragma: no cover if e.code == 'gsrsearch-error' and 'timed out' in e.info: - self.skipTest('gsrsearch returned timeout on site{}:\n{!r}' - .format(mysite, e)) + self.skipTest( + f'gsrsearch returned timeout on site {mysite}:\n{e!r}') if e.code == 'gsrsearch-text-disabled': - self.skipTest('gsrsearch is diabled on site {}:\n{!r}' - .format(mysite, e)) + self.skipTest(f'gsrsearch is diabled on site {mysite}:\n{e!r}') raise def test_search_where_title(self): diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py index 5ea1cfd..5fbdc6e 100755 --- a/tests/site_login_logout_tests.py +++ b/tests/site_login_logout_tests.py @@ -6,7 +6,7 @@ to fail. """ # -# (C) Pywikibot team, 2022 +# (C) Pywikibot team, 2022-2023 # # Distributed under the terms of the MIT license. # @@ -74,7 +74,7 @@ raised = False try: site.login() - except Exception as e: + except Exception as e: # pragma: no cover raised = e self.assertFalse(raised) diff --git a/tests/time_tests.py b/tests/time_tests.py index efa04d3..6e85f8e 100755 --- a/tests/time_tests.py +++ b/tests/time_tests.py @@ -130,7 +130,7 @@ sep = 'T' t1 = Timestamp.utcnow() if not t1.microsecond: # T199179: ensure microsecond is not 0 - t1 = t1.replace(microsecond=1) + t1 = t1.replace(microsecond=1) # pragma: no cover ts1 = t1.isoformat() t2 = Timestamp.fromISOformat(ts1) ts2 = t2.isoformat() @@ -170,7 +170,7 @@ """Test conversion from and to Timestamp format.""" t1 = Timestamp.utcnow() if not t1.microsecond: # T191827: ensure microsecond is not 0 - t1 = t1.replace(microsecond=1000) + t1 = t1.replace(microsecond=1000) # pragma: no cover ts1 = t1.totimestampformat() t2 = Timestamp.fromtimestampformat(ts1) ts2 = t2.totimestampformat() -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913605
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: Ifaaf309ddd14d30f8ec1d8353c8f47d7a720afc1 Gerrit-Change-Number: 913605 Gerrit-PatchSet: 3 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] remove write-test from pywikibot-ci.yml
by Xqt (Code Review)
30 Apr '23
30 Apr '23
Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913652
) Change subject: [tests] remove write-test from pywikibot-ci.yml ...................................................................... [tests] remove write-test from pywikibot-ci.yml write test will be runned in its own action because there are too many failures Change-Id: If6760c4cf05a40d6e11f49fb2339a24a13d7e839 --- M .github/workflows/pywikibot-ci.yml 1 file changed, 11 insertions(+), 2 deletions(-) Approvals: Xqt: Verified; Looks good to me, approved diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml index 7c8a8f0..215613d 100644 --- a/.github/workflows/pywikibot-ci.yml +++ b/.github/workflows/pywikibot-ci.yml @@ -33,7 +33,6 @@ # ubuntu-20.04 required for Python 3.6 - python-version: 3.7 site: wikipedia:test - write-test: true experimental: true - python-version: 3.6 site: False @@ -128,7 +127,6 @@ PYWIKIBOT_TEST_NO_RC: ${{ (matrix.site == 'wikisource:zh' || matrix.test_no_rc) && 1 || 0 }} PYWIKIBOT_TEST_PROD_ONLY: ${{ matrix.test_prod_only && 1 || 0 }} - PYWIKIBOT_TEST_WRITE: ${{ (matrix.site == 'wikipedia:test' && matrix.write-test ) && 1 || 0}} run: | python pwb.py version if [ ${{matrix.site || 0}} != 'wikipedia:test' ]; then -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913652
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: If6760c4cf05a40d6e11f49fb2339a24a13d7e839 Gerrit-Change-Number: 913652 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] Remove experimental attribute for wowwiki tests
by Xqt (Code Review)
29 Apr '23
29 Apr '23
Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913611
) Change subject: [tests] Remove experimental attribute for wowwiki tests ...................................................................... [tests] Remove experimental attribute for wowwiki tests Test can run without experimental attribute after failures were fixed Change-Id: I47bfb46476905279cc3ea6b42048c5a9210f4b89 --- M .github/workflows/pywikibot-ci.yml 1 file changed, 11 insertions(+), 1 deletion(-) Approvals: Xqt: Verified; Looks good to me, approved diff --git a/.github/workflows/pywikibot-ci.yml b/.github/workflows/pywikibot-ci.yml index d165f33..7c8a8f0 100644 --- a/.github/workflows/pywikibot-ci.yml +++ b/.github/workflows/pywikibot-ci.yml @@ -57,7 +57,6 @@ os: ubuntu-20.04 - python-version: 3.8 site: wowwiki:uk - experimental: true - python-version: 3 site: wikipedia:de os: macOS-latest -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913611
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I47bfb46476905279cc3ea6b42048c5a9210f4b89 Gerrit-Change-Number: 913611 Gerrit-PatchSet: 2 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] skip TestUserContribsWithoutUser.test_user_prefix on wowwiki
by jenkins-bot (Code Review)
29 Apr '23
29 Apr '23
jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913568
) Change subject: [tests] skip TestUserContribsWithoutUser.test_user_prefix on wowwiki ...................................................................... [tests] skip TestUserContribsWithoutUser.test_user_prefix on wowwiki Change-Id: Ic11b3835fc14fec6c6720d0f779c12c357aee74e --- M tests/site_generators_tests.py 1 file changed, 12 insertions(+), 0 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/site_generators_tests.py b/tests/site_generators_tests.py index 2f5888a..388d7e5 100755 --- a/tests/site_generators_tests.py +++ b/tests/site_generators_tests.py @@ -1173,6 +1173,9 @@ def test_user_prefix(self): """Test the site.usercontribs() method with userprefix.""" mysite = self.get_site() + if mysite.family.name == 'wowwiki': + self.skipTest(f'Too many timeouts on {mysite}') + for contrib in mysite.usercontribs(userprefix='John', total=5): self.assertIsInstance(contrib, dict) for key in ('user', 'title', 'ns', 'pageid', 'revid'): -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913568
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: Ic11b3835fc14fec6c6720d0f779c12c357aee74e Gerrit-Change-Number: 913568 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] Skip HttpbinTestCase tests when a ServerError occurs
by jenkins-bot (Code Review)
29 Apr '23
29 Apr '23
jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913564
) Change subject: [tests] Skip HttpbinTestCase tests when a ServerError occurs ...................................................................... [tests] Skip HttpbinTestCase tests when a ServerError occurs add a new method fetch() to aspects.HttpbinTestCase which delegates request to http.fetch() but skips the test on ServerErrors. Bug: T335622 Change-Id: Id8199c483c955098053ffe0d04d8d342fa97a489 --- M tests/aspects.py M tests/http_tests.py 2 files changed, 28 insertions(+), 9 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/aspects.py b/tests/aspects.py index d3ebde0..4515cb2 100644 --- a/tests/aspects.py +++ b/tests/aspects.py @@ -49,6 +49,7 @@ DrySite, WarningSourceSkipContextManager, execute_pwb, + skipping, ) @@ -1569,3 +1570,8 @@ def get_httpbin_hostname(self): """Return httpbin hostname.""" return 'httpbin.org' + + def fetch(self, *args, **kwargs): + """Delegate http request to http.fetch but skip on ServerError.""" + with skipping(ServerError): + return http.fetch(*args, **kwargs) diff --git a/tests/http_tests.py b/tests/http_tests.py index a21b7bc..b84eaa5 100755 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -258,21 +258,21 @@ def test_existing_headers(self): """Test fake_user_agent with existing headers.""" - r = http.fetch(self.get_httpbin_url('/status/200'), + r = self.fetch(self.get_httpbin_url('/status/200'), headers={'user-agent': 'EXISTING'}) self.assertEqual(r.request.headers['user-agent'], 'EXISTING') def test_argument_values_changes(self): """Test fake_user_agent with argument value changes.""" - r = http.fetch(self.get_httpbin_url('/status/200'), + r = self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=True) self.assertNotEqual(r.request.headers['user-agent'], http.user_agent()) - r = http.fetch(self.get_httpbin_url('/status/200'), + r = self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=False) self.assertEqual(r.request.headers['user-agent'], http.user_agent()) - r = http.fetch(self.get_httpbin_url('/status/200'), + r = self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent='ARBITRARY') self.assertEqual(r.request.headers['user-agent'], 'ARBITRARY') @@ -280,21 +280,21 @@ """Test fake_user_agent with empty value.""" with self.assertRaisesRegex(ValueError, 'Invalid parameter: use_fake_user_agent'): - http.fetch(self.get_httpbin_url('/status/200'), + self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent='') def test_parameter_set_to_none(self): """Test fake_user_agent with parameter wrongly set to None.""" with self.assertRaisesRegex(ValueError, 'Invalid parameter: use_fake_user_agent'): - http.fetch(self.get_httpbin_url('/status/200'), + self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=None) def test_overridden_domains(self): """Test fake_user_agent with manually overridden domains.""" config.fake_user_agent_exceptions = { self.get_httpbin_hostname(): 'OVERRIDDEN'} - r = http.fetch(self.get_httpbin_url('/status/200'), + r = self.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=False) self.assertEqual(r.request.headers['user-agent'], 'OVERRIDDEN') @@ -564,10 +564,10 @@ 'X-Amzn-Trace-Id', 'X-B3-Parentspanid', 'X-B3-Spanid', 'X-B3-Traceid', 'X-Forwarded-Client-Cert', ) - r_data_request = http.fetch(self.get_httpbin_url('/post'), + r_data_request = self.fetch(self.get_httpbin_url('/post'), method='POST', data={'fish&chips': 'delicious'}) - r_body_request = http.fetch(self.get_httpbin_url('/post'), + r_body_request = self.fetch(self.get_httpbin_url('/post'), method='POST', data={'fish&chips': 'delicious'}) -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913564
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: Id8199c483c955098053ffe0d04d8d342fa97a489 Gerrit-Change-Number: 913564 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] Split LiveFakeUserAgentTestCase
by jenkins-bot (Code Review)
29 Apr '23
29 Apr '23
jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913511
) Change subject: [tests] Split LiveFakeUserAgentTestCase ...................................................................... [tests] Split LiveFakeUserAgentTestCase Change-Id: I3c38d5792d11c976b47a6fe9fb437f4e9338c343 --- M tests/http_tests.py 1 file changed, 32 insertions(+), 26 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/http_tests.py b/tests/http_tests.py index 6d39fca..a21b7bc 100755 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -239,6 +239,7 @@ self.assertIn('Python/' + str(PYTHON_VERSION[0]), http.user_agent()) +@require_modules('fake_useragent') class LiveFakeUserAgentTestCase(HttpbinTestCase): """Test the usage of fake user agent.""" @@ -255,52 +256,48 @@ self.orig_fake_user_agent_exceptions) super().tearDown() - def _test_fetch_use_fake_user_agent(self): - """Test `use_fake_user_agent` argument of http.fetch.""" - # Existing headers - r = http.fetch( - self.get_httpbin_url('/status/200'), - headers={'user-agent': 'EXISTING'}) + def test_existing_headers(self): + """Test fake_user_agent with existing headers.""" + r = http.fetch(self.get_httpbin_url('/status/200'), + headers={'user-agent': 'EXISTING'}) self.assertEqual(r.request.headers['user-agent'], 'EXISTING') - # Argument value changes + def test_argument_values_changes(self): + """Test fake_user_agent with argument value changes.""" r = http.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=True) self.assertNotEqual(r.request.headers['user-agent'], http.user_agent()) + r = http.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=False) self.assertEqual(r.request.headers['user-agent'], http.user_agent()) - r = http.fetch( - self.get_httpbin_url('/status/200'), - use_fake_user_agent='ARBITRARY') + + r = http.fetch(self.get_httpbin_url('/status/200'), + use_fake_user_agent='ARBITRARY') self.assertEqual(r.request.headers['user-agent'], 'ARBITRARY') - # Empty value - with self.assertRaisesRegex( - ValueError, - 'Invalid parameter: use_fake_user_agent'): + def test_empty_valu(self): + """Test fake_user_agent with empty value.""" + with self.assertRaisesRegex(ValueError, + 'Invalid parameter: use_fake_user_agent'): http.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent='') - # Parameter wrongly set to None - with self.assertRaisesRegex( - ValueError, - 'Invalid parameter: use_fake_user_agent'): + def test_parameter_set_to_none(self): + """Test fake_user_agent with parameter wrongly set to None.""" + with self.assertRaisesRegex(ValueError, + 'Invalid parameter: use_fake_user_agent'): http.fetch(self.get_httpbin_url('/status/200'), use_fake_user_agent=None) - # Manually overridden domains + def test_overridden_domains(self): + """Test fake_user_agent with manually overridden domains.""" config.fake_user_agent_exceptions = { self.get_httpbin_hostname(): 'OVERRIDDEN'} - r = http.fetch( - self.get_httpbin_url('/status/200'), use_fake_user_agent=False) + r = http.fetch(self.get_httpbin_url('/status/200'), + use_fake_user_agent=False) self.assertEqual(r.request.headers['user-agent'], 'OVERRIDDEN') - @require_modules('fake_useragent') - def test_fetch_with_fake_useragent(self): - """Test method with fake_useragent module.""" - self._test_fetch_use_fake_user_agent() - class CharsetTestCase(TestCase): -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913511
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I3c38d5792d11c976b47a6fe9fb437f4e9338c343 Gerrit-Change-Number: 913511 Gerrit-PatchSet: 3 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [tests] Ignore disabled_tests from coverage
by Xqt (Code Review)
29 Apr '23
29 Apr '23
Xqt has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913505
) Change subject: [tests] Ignore disabled_tests from coverage ...................................................................... [tests] Ignore disabled_tests from coverage Change-Id: I059dd0eec1a0906ca310ed0b9c19be50eafd67c0 --- M tests/__init__.py 1 file changed, 12 insertions(+), 4 deletions(-) Approvals: Xqt: Verified; Looks good to me, approved diff --git a/tests/__init__.py b/tests/__init__.py index 1de6877..8f10bc7 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -217,10 +217,9 @@ 'Extra test modules (run after library, before scripts):\n {}' .format(', '.join(extra_test_modules))) - if disabled_tests: - unittest_print( - 'Skipping tests (to run: python -m unittest ...):\n {!r}' - .format(disabled_tests)) + if disabled_tests: # pragma: no cover + unittest_print(f'Skipping tests (to run: python -m unittest ...):\n' + f' {disabled_tests!r}') modules = (module for module in chain(library_test_modules, -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913505
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I059dd0eec1a0906ca310ed0b9c19be50eafd67c0 Gerrit-Change-Number: 913505 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [doc] Fix spelling mistake
by jenkins-bot (Code Review)
29 Apr '23
29 Apr '23
jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913504
) Change subject: [doc] Fix spelling mistake ...................................................................... [doc] Fix spelling mistake Change-Id: I65ef12f670229adeeb12e5a3b715141274ff4a54 --- M tests/djvu_tests.py 1 file changed, 11 insertions(+), 2 deletions(-) Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/djvu_tests.py b/tests/djvu_tests.py index 6cdcf95..db008fa 100755 --- a/tests/djvu_tests.py +++ b/tests/djvu_tests.py @@ -2,7 +2,7 @@ """Unit tests for djvu.py.""" # -# (C) Pywikibot team, 2015-2022 +# (C) Pywikibot team, 2015-2023 # # Distributed under the terms of the MIT license. # @@ -116,7 +116,7 @@ def setUpModule(): - """Sekip if djvulibre library not installed.""" + """Skip if djvulibre library not installed.""" with skipping(OSError, msg='djvulibre library not installed.'): dp = subprocess.Popen(['djvudump'], stdout=subprocess.PIPE, -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913504
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I65ef12f670229adeeb12e5a3b715141274ff4a54 Gerrit-Change-Number: 913504 Gerrit-PatchSet: 1 Gerrit-Owner: Xqt <info(a)gno.de> Gerrit-Reviewer: Xqt <info(a)gno.de> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
[Gerrit] ...core[master]: [doc] Update documentation
by Meno25 (Code Review)
29 Apr '23
29 Apr '23
Meno25 has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913219
) Change subject: [doc] Update documentation ...................................................................... [doc] Update documentation Fix broken link Change-Id: I1d04a0f964d97e3f025e02f3633cdd001a7a6022 --- M scripts/README.rst 1 file changed, 12 insertions(+), 1 deletion(-) Approvals: Meno25: Verified; Looks good to me, approved diff --git a/scripts/README.rst b/scripts/README.rst index e7fbffe..0ed2066 100644 --- a/scripts/README.rst +++ b/scripts/README.rst @@ -195,4 +195,4 @@ ** Outdated and deleted scripts can be recovered.** Refer `Outdated core scripts` and `Outdated compat scripts` in our documentation: -https://doc.wikimedia.org/pywikibot/master/scripts/index.html#scripts-descriptions +https://doc.wikimedia.org/pywikibot/master/scripts/index.html#script-descriptions -- To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/913219
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Change-Id: I1d04a0f964d97e3f025e02f3633cdd001a7a6022 Gerrit-Change-Number: 913219 Gerrit-PatchSet: 2 Gerrit-Owner: Meno25 <meno25mail(a)gmail.com> Gerrit-Reviewer: Meno25 <meno25mail(a)gmail.com> Gerrit-Reviewer: jenkins-bot Gerrit-MessageType: merged
1
0
0
0
← Newer
1
...
91
92
93
94
95
96
97
...
1350
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
Results per page:
10
25
50
100
200