jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332248?usp=email )
Change subject: solve_disambiguation: Handle ignore file read errors
......................................................................
solve_disambiguation: Handle ignore file read errors
A suppressed read error leaves text undefined and raises
UnboundLocalError while parsing the optional primary ignore file.
Return on OSError, preserving the initialized ignore list as the
pre-pathlib implementation did.
Change-Id: I5cd04738f19305c04dca351be021ee46f4f58fa7
---
M scripts/solve_disambiguation.py
1 file changed, 3 insertions(+), 1 deletion(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/solve_disambiguation.py b/scripts/solve_disambiguation.py
index 932f425..db69baf 100755
--- a/scripts/solve_disambiguation.py
+++ b/scripts/solve_disambiguation.py
@@ -472,8 +472,10 @@
# The file is stored in the disambiguation/ subdir.
# Create if necessary.
- with suppress(IOError):
+ try:
text = filepath.read_text(encoding='utf-8')
+ except OSError:
+ return
# skip empty lines
self.ignorelist = {line for line in text.splitlines() if line}
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332248?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I5cd04738f19305c04dca351be021ee46f4f58fa7
Gerrit-Change-Number: 1332248
Gerrit-PatchSet: 1
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332212?usp=email )
Change subject: docs: Fix spelling and grammar errors
......................................................................
docs: Fix spelling and grammar errors
Correct misspellings and duplicated words in documentation and docstrings.
Rename misspelled test methods while preserving test discovery.
Change-Id: Ieb7efd876a2dbe8fcbf7fe2c1f82804f20762c50
---
M docs/api_ref/bot.rst
M docs/library_usage.rst
M docs/make.bat
M pywikibot/data/api/_optionset.py
M pywikibot/page/_user.py
M tests/aspects.py
M tests/site_login_logout_tests.py
M tests/ui_options_tests.py
M tests/unlinkbot_tests.py
M tests/wbtypes_tests.py
10 files changed, 12 insertions(+), 12 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/docs/api_ref/bot.rst b/docs/api_ref/bot.rst
index 4903d03..ce3e886 100644
--- a/docs/api_ref/bot.rst
+++ b/docs/api_ref/bot.rst
@@ -27,7 +27,7 @@
.. attribute:: generator
:type: Iterable
- Instance variable to hold the Iterbale processed by :meth:`run`
+ Instance variable to hold the Iterable processed by :meth:`run`
method. The is added to the class with *generator* keyword
argument and the proposed type is a ``Generator``. If not,
:meth:`run` upcast the generator attribute to become a
diff --git a/docs/library_usage.rst b/docs/library_usage.rst
index 344f46d..7ca3b5f 100644
--- a/docs/library_usage.rst
+++ b/docs/library_usage.rst
@@ -90,7 +90,7 @@
:mod:`pywikibot.pagegenerators` are parsed here using
:meth:`GeneratorFactory.handle_args()
<pagegenerators.GeneratorFactory.handle_args>`.
-:25: Local options which are are available for the current bot are
+:25: Local options which are available for the current bot are
parsed in this loop.
:29: Create the bot passing keyword only parameters and run it.
diff --git a/docs/make.bat b/docs/make.bat
index bcc8d53..e70b3a8 100644
--- a/docs/make.bat
+++ b/docs/make.bat
@@ -49,10 +49,10 @@
rem calculating the duration is easy
set /A DURATION=%ENDTIME%-%STARTTIME%
-rem we might have measured the time inbetween days
+rem we might have measured the time between days
if %ENDTIME% LSS %STARTTIME% set set /A DURATION=%STARTTIME%-%ENDTIME%
-rem now break the seconds down to hors, minutes, seconds
+rem now break the seconds down to hours, minutes, seconds
set /A DURATIONH=%DURATION% / 3600
set /A DURATIONM=(%DURATION% - %DURATIONH%*3600) / 60
set /A DURATIONS=(%DURATION% - %DURATIONH%*3600 - %DURATIONM%*60)
diff --git a/pywikibot/data/api/_optionset.py b/pywikibot/data/api/_optionset.py
index 2dcb957..32219a3 100644
--- a/pywikibot/data/api/_optionset.py
+++ b/pywikibot/data/api/_optionset.py
@@ -21,7 +21,7 @@
If it is instantiated with the associated site, module and parameter
it will only allow valid names as options. If instantiated 'lazy
- loaded' it won't checks if the names are valid until the site has
+ loaded' it won't check if the names are valid until the site has
been set (which isn't required, but recommended). The site can only
be set once if it's not None and after setting it, any site (even
None) will fail.
diff --git a/pywikibot/page/_user.py b/pywikibot/page/_user.py
index 303378f..c48003b 100644
--- a/pywikibot/page/_user.py
+++ b/pywikibot/page/_user.py
@@ -317,7 +317,7 @@
return self.site.is_locked(self.username, force)
def isEmailable(self, force: bool = False) -> bool: # noqa: N802
- """Determine whether emails may be send to this user through MediaWiki.
+ """Determine whether emails may be sent to this user through MediaWiki.
:param force: If True, forces reloading the data from API
"""
diff --git a/tests/aspects.py b/tests/aspects.py
index fb23848..bd11cd8 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -1559,7 +1559,7 @@
.. version-changed:: 11.7
Return timeout information.
- :param args: :mod:`pwb` warapper script arguments
+ :param args: :mod:`pwb` wrapper script arguments
:param kwargs: keyword arguments of :func:`tests.utils.execute_pwb`
:return: Result of :func:`tests.utils.execute_pwb`.
"""
diff --git a/tests/site_login_logout_tests.py b/tests/site_login_logout_tests.py
index 42dfb3f..7fa84ff 100755
--- a/tests/site_login_logout_tests.py
+++ b/tests/site_login_logout_tests.py
@@ -7,7 +7,7 @@
"""Test for login and logout methods.
These tests are separated from others because they should not be run in
-paralled CI test tasks. Any logout could lead other parallel tests to
+parallel CI test tasks. Any logout could lead other parallel tests to
fail.
"""
from __future__ import annotations
diff --git a/tests/ui_options_tests.py b/tests/ui_options_tests.py
index e342786..efe1b7c 100755
--- a/tests/ui_options_tests.py
+++ b/tests/ui_options_tests.py
@@ -193,7 +193,7 @@
self.assertEqual(option.result('2'), ('', [options[1]]))
self.assertEqual(option.result('1,2'), ('', [options[0], options[1]]))
- def test_choice_excepton(self) -> None:
+ def test_choice_exception(self) -> None:
"""Test ChoiceException."""
option = ChoiceException('Test', 'T')
self.assertTrue(option.stop)
diff --git a/tests/unlinkbot_tests.py b/tests/unlinkbot_tests.py
index 9352800..b335c3a 100755
--- a/tests/unlinkbot_tests.py
+++ b/tests/unlinkbot_tests.py
@@ -33,7 +33,7 @@
net = False
- def test_edit_replacement_excepton(self) -> None:
+ def test_edit_replacement_exception(self) -> None:
"""Test ChoiceException."""
option = EditReplacementError()
self.assertTrue(option.stop)
diff --git a/tests/wbtypes_tests.py b/tests/wbtypes_tests.py
index 992a824..2b08179 100755
--- a/tests/wbtypes_tests.py
+++ b/tests/wbtypes_tests.py
@@ -920,7 +920,7 @@
with self.assertRaisesRegex(ValueError, regex):
pywikibot.WbGeoShape('A string', self.get_repo())
- def test_WbGeoShape_error_on_non_exitant_page(self) -> None:
+ def test_WbGeoShape_error_on_non_existent_page(self) -> None:
"""Test WbGeoShape error handling of a non-existent page."""
page = Page(self.commons, 'Non-existent page... really')
regex = r'^Page \[\[.+?\]\] must exist\.$'
@@ -995,7 +995,7 @@
with self.assertRaisesRegex(ValueError, regex):
pywikibot.WbTabularData('A string', self.get_repo())
- def test_WbTabularData_error_on_non_exitant_page(self) -> None:
+ def test_WbTabularData_error_on_non_existent_page(self) -> None:
"""Test WbTabularData error handling of a non-existent page."""
page = Page(self.commons, 'Non-existent page... really')
regex = r'^Page \[\[.+?\]\] must exist\.$'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332212?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ieb7efd876a2dbe8fcbf7fe2c1f82804f20762c50
Gerrit-Change-Number: 1332212
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332226?usp=email )
Change subject: tracking_param_remover: Avoid unsafe C tokenizer without GIL
......................................................................
tracking_param_remover: Avoid unsafe C tokenizer without GIL
mwparserfromhell's C tokenizer can segfault on free-threaded
Python when the GIL is disabled. Select its pure-Python tokenizer for
those interpreters while retaining the C tokenizer elsewhere.
Bug: T435717
Change-Id: I2fc816179cbb742e1d623ab0f46f2bf36f275eda
---
M scripts/tracking_param_remover.py
1 file changed, 5 insertions(+), 0 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/tracking_param_remover.py b/scripts/tracking_param_remover.py
index 8f1cd33..49a6683 100755
--- a/scripts/tracking_param_remover.py
+++ b/scripts/tracking_param_remover.py
@@ -27,12 +27,17 @@
import pywikibot
from pywikibot import pagegenerators
from pywikibot.bot import AutomaticTWSummaryBot, ExistingPageBot, SingleSiteBot
+from pywikibot.tools import THREADING_FREE
docuReplacements = { # noqa: N816
'¶ms;': pagegenerators.parameterHelp,
}
+if THREADING_FREE:
+ # The C tokenizer is not safe without the GIL (T435717).
+ mwparserfromhell.parser.use_c = False
+
KNOWN_TRACKER_PARAMS = [
'utm_.+', # universal
'fbclid', # Facebook
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332226?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I2fc816179cbb742e1d623ab0f46f2bf36f275eda
Gerrit-Change-Number: 1332226
Gerrit-PatchSet: 1
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332207?usp=email )
Change subject: docs: Fix clear spelling errors
......................................................................
docs: Fix clear spelling errors
Correct misspellings across comments, docstrings, help, and docs.
Change-Id: If411cd664a78ab2b165b12357713c793ed364d6c
---
M docs/recipes.rst
M docs/scripts/archive.rst
M docs/scripts/outdated.rst
M docs/tests_ref/utils.rst
M pywikibot/pagegenerators/_factory.py
M scripts/category.py
M scripts/checkimages.py
M scripts/redirect.py
M scripts/transwikiimport.py
9 files changed, 10 insertions(+), 10 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/docs/recipes.rst b/docs/recipes.rst
index 9f5b70c..c6f07cd 100644
--- a/docs/recipes.rst
+++ b/docs/recipes.rst
@@ -24,5 +24,5 @@
>>> links = sorted(link['title'] for link in pywikibot.link_regex.finditer(sect.header))
>>> pages = [pywikibot.Page(site, title) for title in links]
-* ``links`` is a list containing all link titles in alphabethical order
+* ``links`` is a list containing all link titles in alphabetical order
* ``pages`` is a sorted list containing all ``Page`` objects
diff --git a/docs/scripts/archive.rst b/docs/scripts/archive.rst
index 4481c24..57723b2 100644
--- a/docs/scripts/archive.rst
+++ b/docs/scripts/archive.rst
@@ -26,7 +26,7 @@
casechecker script
==================
-**Bot to find all pages on the wiki with mixed latin and cyrilic alphabets**
+**Bot to find all pages on the wiki with mixed Latin and Cyrillic alphabets**
catall script
=============
diff --git a/docs/scripts/outdated.rst b/docs/scripts/outdated.rst
index 4a8d2b8..455b0f7 100644
--- a/docs/scripts/outdated.rst
+++ b/docs/scripts/outdated.rst
@@ -43,7 +43,7 @@
commons\_category\_redirect script
----------------------------------
-**Script to clean up non-empty catecory redirect category on Commons**
+**Script to clean up non-empty category redirect category on Commons**
Moves all images, pages and categories in redirect categories to the
target category.
diff --git a/docs/tests_ref/utils.rst b/docs/tests_ref/utils.rst
index 55c0e23..b606293 100644
--- a/docs/tests_ref/utils.rst
+++ b/docs/tests_ref/utils.rst
@@ -3,7 +3,7 @@
*************************************
.. automodule:: tests.utils
- :synopsis: Test utility funktions
+ :synopsis: Test utility functions
:members:
:undoc-members:
:show-inheritance:
diff --git a/pywikibot/pagegenerators/_factory.py b/pywikibot/pagegenerators/_factory.py
index 14e7d73..f7aab25 100644
--- a/pywikibot/pagegenerators/_factory.py
+++ b/pywikibot/pagegenerators/_factory.py
@@ -216,7 +216,7 @@
set the instance variable :attr:`is_preloading` to True or False.
.. version-changed:: 8.0
if ``limit`` option is set and multiple generators are given,
- pages are yieded in a :func:`roundrobin
+ pages are yielded in a :func:`roundrobin
<tools.itertools.roundrobin_generators>` way.
.. version-changed:: 11.3
If *preload* option is set, the preloading generators
diff --git a/scripts/category.py b/scripts/category.py
index 6dc4eaf..88d2b8f 100755
--- a/scripts/category.py
+++ b/scripts/category.py
@@ -373,7 +373,7 @@
self.rebuild()
def rebuild(self) -> None:
- """Rebuild the dabatase."""
+ """Rebuild the database."""
self.cat_content_db = {}
self.superclass_db = {}
diff --git a/scripts/checkimages.py b/scripts/checkimages.py
index ee58463..45c1730 100755
--- a/scripts/checkimages.py
+++ b/scripts/checkimages.py
@@ -1656,7 +1656,7 @@
pywikibot.info(
f'Retrieving the latest {limit} files for checking...')
while True:
- # Defing the Main Class.
+ # Defining the Main Class.
bot = CheckImagesBot(site, sendemail_active=sendemail_active,
duplicates_report=duplicates_report,
log_full_error=log_full_error,
diff --git a/scripts/redirect.py b/scripts/redirect.py
index 95a7af4..7f68287 100755
--- a/scripts/redirect.py
+++ b/scripts/redirect.py
@@ -264,7 +264,7 @@
:[2]: target page title of the redirect, or chain (may not exist)
:[3]: target page of the redirect, or end of chain, or page title
- where chain or loop detecton was halted, or None if unknown
+ where chain or loop detection was halted, or None if unknown
"""
for apiQ in self._next_redirect_group():
gen = pywikibot.data.api.Request(
diff --git a/scripts/transwikiimport.py b/scripts/transwikiimport.py
index 4e5a3d9..8695397 100755
--- a/scripts/transwikiimport.py
+++ b/scripts/transwikiimport.py
@@ -85,7 +85,7 @@
If the target page already exists, the target page will be overwritten
if ``-overwrite`` is set or skipped otherwise.
-The list of pages to be imported can be generated outside of the pywikbot:
+The list of pages to be imported can be generated outside of Pywikibot:
for i in {1..10} ; do python3 pwb.py transwikiimport \
-interwikisource:mul -page:"Page:How to become famous.djvu/$i" \
@@ -110,7 +110,7 @@
The global option ``-simulate`` disables the import and the bot prints
the names of the pages that would be imported. Since the import of pages
-is a quite exceptionell process and potentially dangerous it should be
+is a quite exceptional process and potentially dangerous it should be
made carefully and tested in advance.
The ``-simulate`` option can help to find out which pages would be moved
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332207?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: If411cd664a78ab2b165b12357713c793ed364d6c
Gerrit-Change-Number: 1332207
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332203?usp=email )
Change subject: watchlist: Reuse fetched pages
......................................................................
watchlist: Reuse fetched pages
Return the pages materialized by count_watchlist and display that same list in default mode.
This avoids a second forced retrieval and keeps the count aligned with the displayed pages.
Change-Id: I19f261c17472d4d6dc0d37be7044a3670dbf24f0
---
M scripts/watchlist.py
1 file changed, 5 insertions(+), 5 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/watchlist.py b/scripts/watchlist.py
index 2b8394b..c107abb 100755
--- a/scripts/watchlist.py
+++ b/scripts/watchlist.py
@@ -60,12 +60,13 @@
return [p.title() for p in site.watched_pages()]
-def count_watchlist(site=None) -> None:
+def count_watchlist(site=None) -> list[pywikibot.Page]:
"""Count only the total number of page(s) in watchlist for this wiki."""
if site is None:
site = pywikibot.Site()
- watchlist_count = len(refresh(site))
- pywikibot.info(f'There are {watchlist_count} page(s) in the watchlist.')
+ watchlist = refresh(site)
+ pywikibot.info(f'There are {len(watchlist)} page(s) in the watchlist.')
+ return watchlist
def count_watchlist_all(quiet=False) -> None:
@@ -162,8 +163,7 @@
count_watchlist_all()
else:
site = pywikibot.Site()
- count_watchlist(site)
- watchlist = list(site.watched_pages(force=True))
+ watchlist = count_watchlist(site)
for page in watchlist:
try:
pywikibot.stdout(page.title())
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332203?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I19f261c17472d4d6dc0d37be7044a3670dbf24f0
Gerrit-Change-Number: 1332203
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1331669?usp=email )
Change subject: itertools: Preserve colliding intersection items
......................................................................
itertools: Preserve colliding intersection items
Keep yielded items in the seen set instead of storing only their hash
values. Set membership then resolves collisions with equality, preventing
unequal items from being silently discarded.
Change-Id: Idcbde6948c95a5c73f50a4a921b36dfe3c297bb1
---
M pywikibot/tools/itertools.py
M tests/tools_tests.py
2 files changed, 16 insertions(+), 3 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/tools/itertools.py b/pywikibot/tools/itertools.py
index 457face..c32ac4a 100644
--- a/pywikibot/tools/itertools.py
+++ b/pywikibot/tools/itertools.py
@@ -158,7 +158,7 @@
ones = collections.Counter(range(n_gen))
active_iterables = set(range(n_gen))
- seen = set()
+ seen: set[Hashable] = set()
# Get items from iterables in a round-robin way.
sentinel = object()
@@ -169,7 +169,7 @@
active_iterables.discard(index)
continue
- if not allow_duplicates and hash(item) in seen:
+ if not allow_duplicates and item in seen:
continue
# Each cache entry is a Counter of iterables' index
@@ -181,7 +181,7 @@
# Remove item from cache if possible or decrease Counter entry
if not allow_duplicates:
del cache[item]
- seen.add(hash(item))
+ seen.add(item)
elif cache[item] == ones:
del cache[item]
else:
diff --git a/tests/tools_tests.py b/tests/tools_tests.py
index 9ae9c68..14c73d9 100755
--- a/tests/tools_tests.py
+++ b/tests/tools_tests.py
@@ -823,6 +823,19 @@
"""Test basic intersect with duplicates."""
self.assertEqualItertools(['aabc', 'dddb', 'baa'])
+ def test_intersect_hash_collision(self) -> None:
+ """Test unequal items with the same hash are not deduplicated."""
+ class CollidingInt(int):
+
+ """Integer whose instances all share one hash value."""
+
+ def __hash__(self) -> int:
+ """Return a constant hash."""
+ return 1
+
+ values = [CollidingInt(1), CollidingInt(2)]
+ self.assertEqualItertools([values, values])
+
def test_intersect_with_accepted_dups(self) -> None:
"""Test intersect with duplicates accepted."""
self.assertEqualItertoolsWithDuplicates(['abc', 'db', 'ba'])
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1331669?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Idcbde6948c95a5c73f50a4a921b36dfe3c297bb1
Gerrit-Change-Number: 1331669
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332192?usp=email )
Change subject: download_dump: Prompt for empty store path
......................................................................
download_dump: Prompt for empty store path
Normalize the path only after falling back to interactive input.
A bare -storepath option now prompts instead of silently selecting the current directory.
Change-Id: Ia79ac7229e6b2aaaa16ffab4f65572fc48fe9dae
---
M scripts/download_dump.py
M tests/download_dump_tests.py
2 files changed, 19 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/download_dump.py b/scripts/download_dump.py
index 8721a24..bce2ac0 100755
--- a/scripts/download_dump.py
+++ b/scripts/download_dump.py
@@ -209,8 +209,8 @@
continue
if option == 'storepath':
- opts[option] = os.path.abspath(value) or pywikibot.input(
- 'Enter the store path: ')
+ opts[option] = os.path.abspath(
+ value or pywikibot.input('Enter the store path: '))
continue
if option == 'dumpdate':
diff --git a/tests/download_dump_tests.py b/tests/download_dump_tests.py
index 7d090be..e8440ef 100755
--- a/tests/download_dump_tests.py
+++ b/tests/download_dump_tests.py
@@ -17,6 +17,23 @@
from tests.aspects import TestCase
+class DownloadDumpMainTestCase(TestCase):
+
+ """Test :func:`download_dump.main`."""
+
+ net = False
+
+ @patch.object(download_dump.pywikibot, 'input',
+ return_value='prompted-path')
+ @patch.object(download_dump.pywikibot, 'handle_args',
+ side_effect=lambda args: args)
+ def test_empty_storepath_prompts(self, _, input_mock) -> None:
+ """Test that an empty store path prompts for a value."""
+ download_dump.main('-storepath:')
+
+ input_mock.assert_called_once_with('Enter the store path: ')
+
+
class DownloadDumpBotTestCase(TestCase):
"""Test :class:`download_dump.DownloadDumpBot`."""
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332192?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: Ia79ac7229e6b2aaaa16ffab4f65572fc48fe9dae
Gerrit-Change-Number: 1332192
Gerrit-PatchSet: 2
Gerrit-Owner: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot
jenkins-bot has submitted this change. ( https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332185?usp=email )
Change subject: Fix docstring for Wikipedia Family class
......................................................................
Fix docstring for Wikipedia Family class
Change-Id: I08fcbf230ac45503155e0218e105c4bbdc831070
Signed-off-by: Xqt <info(a)gno.de>
---
M pywikibot/families/wikipedia_family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
Mahveotm: Looks good to me, but someone else must approve
diff --git a/pywikibot/families/wikipedia_family.py b/pywikibot/families/wikipedia_family.py
index b3bc6fe..6944027 100644
--- a/pywikibot/families/wikipedia_family.py
+++ b/pywikibot/families/wikipedia_family.py
@@ -11,7 +11,7 @@
class Family(family.WikimediaSubdomainFamily):
- """Family module for Wikipedia."""
+ """Family class for Wikipedia."""
name = 'wikipedia'
--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1332185?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I08fcbf230ac45503155e0218e105c4bbdc831070
Gerrit-Change-Number: 1332185
Gerrit-PatchSet: 3
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Mahveotm <mahveotm(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot