XZise has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209185

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/85/209185/1

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):

-- 
To view, visit https://gerrit.wikimedia.org/r/209185
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9523f715b930194eff347ed5a9abb8b95226f965
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: XZise <commodorefabia...@gmx.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to