jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/492478 )
Change subject: [doc] Add Ananth subray to CREDITS
......................................................................
[doc] Add Ananth subray to CREDITS
Change-Id: I31204b7878e88b3cc07d71303dfa8be1665bb33a
---
M CREDITS
1 file changed, 1 insertion(+), 0 deletions(-)
Approvals:
Ananth subray: Looks good to me, but someone else must approve
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/CREDITS b/CREDITS
index 14bd2c8..2a98c8b 100644
--- a/CREDITS
+++ b/CREDITS
@@ -13,6 +13,7 @@
Alexander Shtyrov
Allen Guo
Amir Sarabadani
+Ananth subray
André Costa
Andre Engels
André Malafaya Baptista
--
To view, visit https://gerrit.wikimedia.org/r/492478
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I31204b7878e88b3cc07d71303dfa8be1665bb33a
Gerrit-Change-Number: 492478
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info(a)gno.de>
Gerrit-Reviewer: Ananth subray <ananth.subray(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444(a)gmail.com>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/492466 )
Change subject: pwb.py: Simplify the import system
......................................................................
pwb.py: Simplify the import system
- Use `import pywikibot as pwb` instead of `pwb = pywikibot` in the else
clause of the try statement.
- There is no need to call tryimport_pwb in main() because it's already
been imported earlier.
- There is no need to call tryimport_pwb in run_python_file(), just make
sure it is imported before calling it.
- No need for remove_modules() function. AFAICT, none of the
config-dependant modules can be loaded successfully when the config file
is not present. Removing and reimporting others is of no use.
- Remove the tryimport_pwb() as is it no longer used.
Change-Id: I49d728e08edd14edb5b4203d46349f39c1b75dc3
---
M pwb.py
1 file changed, 3 insertions(+), 30 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py
index 369e789..80c9aac 100755
--- a/pwb.py
+++ b/pwb.py
@@ -46,30 +46,6 @@
pwb = None
-def remove_modules():
- """Remove pywikibot modules."""
- for name in list(sys.modules):
- if name.startswith('pywikibot'):
- del sys.modules[name]
-
-
-def tryimport_pwb():
- """Try to import pywikibot.
-
- If so, we need to patch pwb.argvu, too.
- If pywikibot is not available, we create a mock object to remove the
- need for if statements further on.
- """
- global pwb
- try:
- import pywikibot
- except RuntimeError:
- remove_modules()
- os.environ['PYWIKIBOT_NO_USER_CONFIG'] = '2'
- import pywikibot
- pwb = pywikibot
-
-
# The following snippet was developed by Ned Batchelder (and others)
# for coverage [1], with python 3 support [2] added later,
# and is available under the BSD license (see [3])
@@ -87,8 +63,6 @@
`args` is the argument array to present as sys.argv, as unicode strings.
"""
- tryimport_pwb()
-
# Create a module to serve as __main__
old_main_mod = sys.modules['__main__']
# it's explicitly using str() to bypass unicode_literals in Python 2
@@ -174,8 +148,10 @@
_pwb_dir = str(_pwb_dir)
os.environ['PYWIKIBOT_DIR_PWB'] = _pwb_dir
try:
- import pywikibot
+ import pywikibot as pwb
except RuntimeError:
+ os.environ['PYWIKIBOT_NO_USER_CONFIG'] = '2'
+ import pywikibot as pwb
# user-config.py to be created
if filename is not None and not (filename.startswith('generate_')
or filename == 'version.py'):
@@ -188,8 +164,6 @@
# we need to re-start the entire process. Ask the user to do so.
print('Now, you have to re-execute the command to start your script.')
sys.exit(1)
-else:
- pwb = pywikibot
def main():
@@ -197,7 +171,6 @@
global filename
if filename:
file_package = None
- tryimport_pwb()
argvu = pwb.argvu[1:]
if not os.path.exists(filename):
script_paths = ['scripts',
--
To view, visit https://gerrit.wikimedia.org/r/492466
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I49d728e08edd14edb5b4203d46349f39c1b75dc3
Gerrit-Change-Number: 492466
Gerrit-PatchSet: 2
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)
jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/492465 )
Change subject: test_protectedpages_create: Do not expect pages to not exist
......................................................................
test_protectedpages_create: Do not expect pages to not exist
Bug: T205883
Change-Id: I723edb2b2c7cdfc67c9eecdce591933b151c21c5
---
M tests/site_tests.py
1 file changed, 1 insertion(+), 5 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/site_tests.py b/tests/site_tests.py
index 3b94764..0e0f1eb 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -989,11 +989,7 @@
raise unittest.SkipTest('requires v1.15+')
pages = list(self.get_site().protectedpages(type='create', total=10))
- for page in pages:
- self.assertFalse(
- page.exists(),
- '\n{page} does unexpectedly exist on site {page.site}'
- .format(page=page))
+ # Do not check for the existence of pages as they might exist (T205883)
self.assertLessEqual(len(pages), 10)
def test_protectedpages_edit(self):
--
To view, visit https://gerrit.wikimedia.org/r/492465
To unsubscribe, or for help writing mail filters, visit https://gerrit.wikimedia.org/r/settings
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I723edb2b2c7cdfc67c9eecdce591933b151c21c5
Gerrit-Change-Number: 492465
Gerrit-PatchSet: 1
Gerrit-Owner: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Dalba <dalba.wiki(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot (75)