jenkins-bot has submitted this change and it was merged.
Change subject: [FIX] http_tests: Reset version number ......................................................................
[FIX] http_tests: Reset version number
After 65450196 has been implemented it changed the version number to an invalid value which worked for the test but not for subsequent tests. This is caching the old value and restoring it after the tests.
Change-Id: I9523f715b930194eff347ed5a9abb8b95226f965 --- M tests/http_tests.py 1 file changed, 11 insertions(+), 7 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/http_tests.py b/tests/http_tests.py index a42557b..f3255fd 100644 --- a/tests/http_tests.py +++ b/tests/http_tests.py @@ -330,13 +330,17 @@ self.assertEqual('%E2%81%82', http.user_agent_username(u'⁂'))
def test_version(self): - pywikibot.version.cache = None - http.user_agent(format_string='version does not appear') - self.assertIsNone(pywikibot.version.cache) - pywikibot.version.cache = {'rev': 'dummy'} - self.assertEqual(http.user_agent(format_string='{version} does appear'), - 'dummy does appear') - self.assertIsNotNone(pywikibot.version.cache) + old_cache = pywikibot.version.cache + try: + pywikibot.version.cache = None + http.user_agent(format_string='version does not appear') + self.assertIsNone(pywikibot.version.cache) + pywikibot.version.cache = {'rev': 'dummy'} + self.assertEqual(http.user_agent(format_string='{version} does appear'), + 'dummy does appear') + self.assertIsNotNone(pywikibot.version.cache) + finally: + pywikibot.version.cache = old_cache
class DefaultUserAgentTestCase(TestCase):
pywikibot-commits@lists.wikimedia.org