Merlijn van Deen has uploaded a new change for review.

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

Change subject: Make sure unittest2 is only used on Python 2.6
......................................................................

Make sure unittest2 is only used on Python 2.6

Change-Id: I4fe7e3497d91bf3b5d53d649040490d02bc5613b
---
M tests/utils.py
1 file changed, 3 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/pywikibot/core 
refs/changes/78/154478/1

diff --git a/tests/utils.py b/tests/utils.py
index f767538..ddaaf9e 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -9,16 +9,11 @@
 #
 import time
 import sys
-try:
+
+if sys.version_info < (2, 7):
     # Unittest2 is a backport of python 2.7s unittest module to python 2.6
-    # Trying to import unittest2 has to happen first because 2.6 does have a
-    # unittest module in the standard library but that doesn't support all the
-    # features of the one found in python 2.7, so importing unittest first and
-    # then trying to figure out if it supports the features used would mean
-    # checking the module contents etc. Just catching an ImportError once is
-    # much easier.
     import unittest2 as unittest
-except ImportError:
+else:
     import unittest
 
 import pywikibot

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4fe7e3497d91bf3b5d53d649040490d02bc5613b
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to