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 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]