File mock-unittest2py27.patch of Package python-mock
# HG changeset patch
# User Sascha Peilicke <sasch.pe@gmx.de>
# Date 1392200447 -3600
# Wed Feb 12 11:20:47 2014 +0100
# Node ID 3f15152f49e49e745d63e066b23b482454c67fc9
# Parent d356250e275daa62b2972521885f42fa639341e6
Fix unittest2 check for Python-2.7
The features of unittest2 are available from py2.7+ or py3.2+. Fix the test accordingly.
While at it, simplify other related tests.
diff -r d356250e275d -r 3f15152f49e4 setup.py
--- a/setup.py Tue Apr 09 14:53:33 2013 +0100
+++ b/setup.py Wed Feb 12 11:20:47 2014 +0100
@@ -7,6 +7,7 @@
from mock import __version__
import os
+import sys
NAME = 'mock'
@@ -66,7 +67,11 @@
except ImportError:
from distutils.core import setup
else:
- params['tests_require'] = ['unittest2']
- params['test_suite'] = 'unittest2.collector'
+ info = sys.version_info[:3]
+ if info >= (3, 2, 0) or (info[0] == 2 and info >= (2, 7, 0)):
+ params['test_suite'] = 'tests'
+ else:
+ params['tests_require'] = ['unittest2']
+ params['test_suite'] = 'unittest2.collector'
setup(**params)
diff -r d356250e275d -r 3f15152f49e4 tests/support.py
--- a/tests/support.py Tue Apr 09 14:53:33 2013 +0100
+++ b/tests/support.py Wed Feb 12 11:20:47 2014 +0100
@@ -1,8 +1,11 @@
import sys
-info = sys.version_info
-if info[:3] >= (3, 2, 0):
- # for Python 3.2 ordinary unittest is fine
+info = sys.version_info[:3]
+inPy3k = info[0] == 3
+with_available = info >= (2, 5, 0)
+
+if info >= (3, 2, 0) or (info[0] == 2 and info >= (2, 7, 0)):
+ # for Python 3.2+ or 2.7+ ordinary unittest is fine
import unittest as unittest2
else:
import unittest2
@@ -15,10 +18,6 @@
return hasattr(obj, '__call__')
-inPy3k = sys.version_info[0] == 3
-with_available = sys.version_info[:2] >= (2, 5)
-
-
def is_instance(obj, klass):
"""Version of is_instance that doesn't access __class__"""
return issubclass(type(obj), klass)