summaryrefslogtreecommitdiff
path: root/setuptools/tests/py26compat.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-02 18:38:36 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-02 18:38:36 -0500
commit16ee10c47583a4a2b7480af6fc5a205343acfdfd (patch)
tree7cfbb6d488a92fa01ddb86d6f226f549ad26a01e /setuptools/tests/py26compat.py
parent866ff739f6e64aaaefcf7816263410527c9f55f7 (diff)
parent41f2c5ec8dd669747f3cfd8d6b2ae9a40d219545 (diff)
downloadpython-setuptools-git-16ee10c47583a4a2b7480af6fc5a205343acfdfd.tar.gz
Merge with 10.2.1
--HG-- branch : feature/issue-229
Diffstat (limited to 'setuptools/tests/py26compat.py')
-rw-r--r--setuptools/tests/py26compat.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py
index d4fb891a..c53b4809 100644
--- a/setuptools/tests/py26compat.py
+++ b/setuptools/tests/py26compat.py
@@ -1,14 +1,11 @@
-import unittest
+import sys
+import tarfile
+import contextlib
-try:
- # provide skipIf for Python 2.4-2.6
- skipIf = unittest.skipIf
-except AttributeError:
- def skipIf(condition, reason):
- def skipper(func):
- def skip(*args, **kwargs):
- return
- if condition:
- return skip
- return func
- return skipper
+def _tarfile_open_ex(*args, **kwargs):
+ """
+ Extend result as a context manager.
+ """
+ return contextlib.closing(tarfile.open(*args, **kwargs))
+
+tarfile_open = _tarfile_open_ex if sys.version_info < (2,7) else tarfile.open