jenkins-bot has submitted this change and it was merged.

Change subject: Use unittest2 for python <2.7.3
......................................................................


Use unittest2 for python <2.7.3

The unittest lib shipped with Python 2.7.2 has a minor issue and isn't
compatible with Pywikibot due to T106512.

Change-Id: I63baf41ff74d09bff293d325eb08a8a16b414f75
---
M dev-requirements.txt
M setup.py
M tests/__init__.py
3 files changed, 11 insertions(+), 7 deletions(-)

Approvals:
  John Vandenberg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/dev-requirements.txt b/dev-requirements.txt
index ee37c1b..7746b8e 100644
--- a/dev-requirements.txt
+++ b/dev-requirements.txt
@@ -1,6 +1,6 @@
 # This is a PIP 6+ requirements file for development dependencies
 #
-unittest2==0.8.0 ; python_version < '2.7'
+unittest2==0.8.0 ; python_full_version < '2.7.3'
 
 six
 
diff --git a/setup.py b/setup.py
index 01920d1..0d6ad73 100644
--- a/setup.py
+++ b/setup.py
@@ -92,17 +92,20 @@
     'git+https://github.com/nlhepler/pydot#egg=pydot-1.0.29',
 ]
 
+if PYTHON_VERSION < (2, 7, 3):
+    # work around distutils hardcoded unittest dependency
+    # work around T106512
+    import unittest  # noqa
+    if 'test' in sys.argv:
+        import unittest2
+        sys.modules['unittest'] = unittest2
+
 if sys.version_info[0] == 2:
     if PY26:
         # requests security extra includes pyOpenSSL. cryptography is the
         # dependency of pyOpenSSL. 0.8.2 is the newest and compatible version
         # for Python 2.6, which won't raise unexpected DeprecationWarning.
         extra_deps['security'].append('cryptography<=0.8.2')
-        # work around distutils hardcoded unittest dependency
-        import unittest  # noqa
-        if 'test' in sys.argv:
-            import unittest2
-            sys.modules['unittest'] = unittest2
 
         script_deps['replicate_wiki.py'] = ['argparse']
         dependencies.append('future')  # provides collections backports
diff --git a/tests/__init__.py b/tests/__init__.py
index df4e368..82757ed 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -27,8 +27,9 @@
     print("ImportError: %s" % e)
     sys.exit(1)
 
-if sys.version_info < (2, 7):
+if sys.version_info < (2, 7, 3):
     # Unittest2 is a backport of python 2.7s unittest module to python 2.6
+    # Also use unittest2 for python 2.7.2 (T106512)
     import unittest2 as unittest
 else:
     import unittest

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63baf41ff74d09bff293d325eb08a8a16b414f75
Gerrit-PatchSet: 4
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: VcamX <vca...@gmail.com>
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

Reply via email to