jenkins-bot has submitted this change and it was merged. Change subject: [IMPROV] Siteinfo call test changes cache ......................................................................
[IMPROV] Siteinfo call test changes cache Instead of waiting a second and hoping that the server returns a new time value it now changes the cached value and thus testing that it gets new data returned and not the cached ones. Change-Id: I5a787864b340bf4391c673a5f9ac6867a804bdd4 --- M tests/site_tests.py 1 file changed, 6 insertions(+), 3 deletions(-) Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified diff --git a/tests/site_tests.py b/tests/site_tests.py index 6a2c530..e03ec6f 100644 --- a/tests/site_tests.py +++ b/tests/site_tests.py @@ -15,7 +15,6 @@ from collections import Iterable from datetime import datetime import re -import time import pywikibot @@ -79,12 +78,16 @@ def test_siteinfo_normal_call(self): """Test calling the Siteinfo without setting dump.""" - # This basically checks that the time is different old = self.site.siteinfo('general') self.assertIn('time', old) self.assertEqual(old, self.site.siteinfo['general']) self.assertEqual(self.site.siteinfo('general'), old) - time.sleep(1) + # Siteinfo always returns copies so it's not possible to directly check + # if they are the same dict or if they have been rerequested unless the + # content also changes so force that the content changes + self.assertNotIn('DUMMY', old) + self.site.siteinfo._cache['general'][0]['DUMMY'] = 42 + self.assertIn('DUMMY', self.site.siteinfo('general')) self.assertNotEqual(self.site.siteinfo('general', force=True), old) self.assertDeprecation('Calling siteinfo is deprecated, use itself instead.') -- To view, visit https://gerrit.wikimedia.org/r/218368 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I5a787864b340bf4391c673a5f9ac6867a804bdd4 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/core Gerrit-Branch: master Gerrit-Owner: XZise <commodorefabia...@gmx.de> Gerrit-Reviewer: John Vandenberg <jay...@gmail.com> Gerrit-Reviewer: Ladsgroup <ladsgr...@gmail.com> Gerrit-Reviewer: Merlijn van Deen <valhall...@arctus.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ Pywikibot-commits mailing list Pywikibot-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits