jenkins-bot has submitted this change and it was merged.
Change subject: tests/aspects: Skip setUpClass if TestCase skipped
......................................................................
tests/aspects: Skip setUpClass if TestCase skipped
The class IndexPageTestCase earlier checked for bs4 as a
class decorator. But that check doesn't seem to work and is
a known bug in nosetests. We now modify setUpClass() to also
be skipped if the class is supposed to be skipped.
Bug: T129965
Change-Id: Iec2f706aa832f7bd20e56fbc3427e8f315499591
---
M tests/aspects.py
1 file changed, 11 insertions(+), 2 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/aspects.py b/tests/aspects.py
index 5b2670a..e9a8788 100644
--- a/tests/aspects.py
+++ b/tests/aspects.py
@@ -328,8 +328,17 @@
except ImportError:
missing += [required_module]
if missing:
- return unittest.skip('{0} not installed'.format(
- ', '.join(missing)))(obj)
+ skip_decorator = unittest.skip('{0} not installed'.format(
+ ', '.join(missing)))
+ if (inspect.isclass(obj) and issubclass(obj, TestCaseBase) and
+ 'nose' in sys.modules.keys()):
+ # There is a known bug in nosetests which causes setUpClass()
+ # to be called even if the unittest class is skipped.
+ # Here, we decorate setUpClass() as a patch to skip it
+ # because of the missing modules too.
+ # Upstream report: https://github.com/nose-devs/nose/issues/946
+ obj.setUpClass = classmethod(skip_decorator(lambda cls: None))
+ return skip_decorator(obj)
else:
return obj
--
To view, visit https://gerrit.wikimedia.org/r/277465
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iec2f706aa832f7bd20e56fbc3427e8f315499591
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: AbdealiJK <abdealikothari(a)gmail.com>
Gerrit-Reviewer: AbdealiJK <abdealikothari(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>
Build Update for wikimedia/pywikibot-core
-------------------------------------
Build: #3345
Status: Errored
Duration: 1 hour, 45 minutes, and 43 seconds
Commit: df2c09a (master)
Author: darthbhyrava
Message: Reimplement imageuncat's -recentchanges as a pagegenerators CLA
Modify pagegenerators' -recentchanges in order to also implement
imageuncat's corresponding parameter functionality. Add required
test to pagegenerators_tests.
Deprecate -recentchanges in imageuncat, and redirect -recentchanges'
code from imageuncat to pagegenerators.
Bug: T129193
Change-Id: I86251d22e9ef0e376e780093e9e53d69da7b6e0e
View the changeset: https://github.com/wikimedia/pywikibot-core/compare/49359ba9179c...df2c09aa…
View the full build log and details: https://travis-ci.org/wikimedia/pywikibot-core/builds/117266490
--
You can configure recipients for build notifications in your .travis.yml file. See https://docs.travis-ci.com/user/notifications
jenkins-bot has submitted this change and it was merged.
Change subject: Reimplement imageuncat's -recentchanges as a pagegenerators CLA
......................................................................
Reimplement imageuncat's -recentchanges as a pagegenerators CLA
Modify pagegenerators' -recentchanges in order to also implement
imageuncat's corresponding parameter functionality. Add required
test to pagegenerators_tests.
Deprecate -recentchanges in imageuncat, and redirect -recentchanges'
code from imageuncat to pagegenerators.
Bug: T129193
Change-Id: I86251d22e9ef0e376e780093e9e53d69da7b6e0e
---
M pywikibot/pagegenerators.py
M scripts/imageuncat.py
M tests/pagegenerators_tests.py
3 files changed, 62 insertions(+), 9 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index 99a3b60..10fde98 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -31,6 +31,7 @@
import sys
import time
+from datetime import timedelta
from warnings import warn
import pywikibot
@@ -181,7 +182,17 @@
-recentchanges Work on the pages with the most recent changes. If
given as -recentchanges:x, will work on the x most recently
- changed pages.
+ changed pages. If given as -recentchanges:offset,duration it will
+ work on pages changed from 'offset' minutes with 'duration'
+ minutes of timespan.
+
+ By default, if no values follow -recentchanges, then we pass
+ -recentchanges:x where x = 60
+
+ Examples:
+ -recentchanges:20 will give the 20 most recently changed pages
+ -recentchanges:120,70 will give pages with 120 offset
+ minutes and 70 minutes of timespan
-unconnectedpages Work on the most recent unconnected pages to the Wikibase
repository. Given as -unconnectedpages:x, will work on the
@@ -674,11 +685,29 @@
gen = RandomPageGenerator(total=intNone(value), site=self.site,
namespace=namespaces)
elif arg == '-recentchanges':
- value = int(value) if value else 60
+ rcstart = None
+ rcend = None
+ params = value.split(',')
+ if len(params) == 2:
+ offset = float(params[0])
+ duration = float(params[1])
+ if offset < 0 or duration < 0:
+ raise ValueError('Negative valued parameters passed.')
+ elif len(params) > 2:
+ raise ValueError('More than two parameters passed.')
+ else:
+ value = int(value) if value else 60
+ if len(params) == 2:
+ ts_time = self.site.server_time()
+ rcstart = ts_time + timedelta(minutes=-(offset + duration))
+ rcend = ts_time + timedelta(minutes=-offset)
gen = RecentChangesPageGenerator(namespaces=self.namespaces,
- total=value,
+ start=rcstart,
+ end=rcend,
site=self.site,
+ reverse=True,
_filter_unique=self._filter_unique)
+
elif arg == '-liverecentchanges':
gen = LiveRCPageGenerator(self.site, total=intNone(value))
elif arg == '-file':
diff --git a/scripts/imageuncat.py b/scripts/imageuncat.py
index b63f4f6..38cdaf8 100755
--- a/scripts/imageuncat.py
+++ b/scripts/imageuncat.py
@@ -8,11 +8,14 @@
This script is working on the given site, so if the commons should be handled,
the site commons should be given and not a Wikipedia or similar.
--yesterday Go through all uploads from yesterday.
+-yesterday Go through all uploads from yesterday. (Deprecated here, moved
+ to pagegenerators)
--recentchanges Go through the changes made between 120 minutes and 70
- minutes ago. (This overrides the '-recentchanges' default
- generator)
+-recentchanges Go through the changes made from 'offset' minutes with 'duration'
+ minutes of timespan. It must be given two arguments as
+ '-recentchanges:offset,duration'
+
+ Default value of offset is 120, and that of duration is 70
¶ms;
"""
@@ -32,7 +35,9 @@
import pywikibot
from pywikibot.exceptions import ArgumentDeprecationWarning
from pywikibot import pagegenerators
-from pywikibot.tools import issue_deprecation_warning
+from pywikibot.tools import (
+ issue_deprecation_warning, deprecated
+)
docuReplacements = {
'¶ms;': pagegenerators.parameterHelp,
@@ -1267,6 +1272,7 @@
yield logentry.page()
+@deprecated('RecentChangesPageGenerator')
def recentChanges(site=None, delay=0, block=70):
"""
Return a pagegenerator containing all the images edited in a certain timespan.
@@ -1371,6 +1377,9 @@
genFactory = pagegenerators.GeneratorFactory(site)
for arg in local_args:
+ param_arg, sep, param_value = arg.partition(':')
+ if param_value == '':
+ param_value = None
if arg.startswith('-yesterday'):
generator = uploadedYesterday(site)
issue_deprecation_warning(
@@ -1378,7 +1387,13 @@
'-logevents:"upload,,YYYYMMDD,YYYYMMDD"',
2, ArgumentDeprecationWarning)
elif arg.startswith('-recentchanges'):
- generator = recentChanges(site=site, delay=120)
+ if param_value is None:
+ arg = arg + ':120,70'
+ issue_deprecation_warning(
+ '-recentchanges',
+ '-recentchanges:offset,duration',
+ 2, ArgumentDeprecationWarning)
+ genFactory.handleArg(arg)
else:
genFactory.handleArg(arg)
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index 6c70194..150574d 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -803,6 +803,15 @@
self.assertIsNotNone(gen)
self.assertPagesInNamespaces(gen, 1)
+ def test_recentchanges_timespan(self):
+ """Test recentchanges generator with offset and duration params."""
+ gf = pagegenerators.GeneratorFactory(site=self.site)
+ gf.handleArg('-recentchanges:120,70')
+ gen = gf.getCombinedGenerator()
+ self.assertIsNotNone(gen)
+ self.assertRaises(ValueError, gf.handleArg, '-recentchanges:3,2,1')
+ self.assertRaises(ValueError, gf.handleArg, '-recentchanges:-10,20')
+
def test_recentchanges_ns_default(self):
"""Test recentchanges generator."""
gf = pagegenerators.GeneratorFactory(site=self.site)
--
To view, visit https://gerrit.wikimedia.org/r/276535
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I86251d22e9ef0e376e780093e9e53d69da7b6e0e
Gerrit-PatchSet: 10
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Darthbhyrava <hbhyrava(a)gmail.com>
Gerrit-Reviewer: Darthbhyrava <hbhyrava(a)gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Legoktm <legoktm.wikipedia(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: Polybuildr <v.a.ghaisas(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot <>
jenkins-bot has submitted this change and it was merged.
Change subject: Fix ID for Rhea
......................................................................
Fix ID for Rhea
Q108419 is the wrong Rhea - this is the female Titan,
Q15050 is the moon of Saturn
Change-Id: I1d15e017e1216c8c25af199da01d70be4c13478a
---
M pywikibot/families/wikidata_family.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/pywikibot/families/wikidata_family.py b/pywikibot/families/wikidata_family.py
index 37d3933..5589e6f 100644
--- a/pywikibot/families/wikidata_family.py
+++ b/pywikibot/families/wikidata_family.py
@@ -70,7 +70,7 @@
'phobos': 'http://www.wikidata.org/entity/Q7547',
'phoebe': 'http://www.wikidata.org/entity/Q17975',
'pluto': 'http://www.wikidata.org/entity/Q339',
- 'rhea': 'http://www.wikidata.org/entity/Q108419',
+ 'rhea': 'http://www.wikidata.org/entity/Q15050',
'tethys': 'http://www.wikidata.org/entity/Q15047',
'titan': 'http://www.wikidata.org/entity/Q2565',
'titania': 'http://www.wikidata.org/entity/Q3322',
--
To view, visit https://gerrit.wikimedia.org/r/278530
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d15e017e1216c8c25af199da01d70be4c13478a
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <smalyshev(a)wikimedia.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: jenkins-bot <>