diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2016-12-08 13:20:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-08 13:20:52 +0100 |
commit | 2f207e0e15ad243dd24eafce8b60ed2c77d6e725 (patch) | |
tree | 9460e9e1178c21389386e49e336550093d34448b /git/test/lib | |
parent | a8437c014b0a9872168b01790f5423e8e9255840 (diff) | |
parent | f3d5df2ce3addd9e9e1863f4f33665a16b415b71 (diff) | |
download | gitpython-2f207e0e15ad243dd24eafce8b60ed2c77d6e725.tar.gz |
Merge pull request #541 from andy-maier/py26_fixes
Fixes to support Python 2.6 again.
Diffstat (limited to 'git/test/lib')
-rw-r--r-- | git/test/lib/helper.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index 1515f2a1..743f720c 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -7,20 +7,24 @@ from __future__ import print_function import contextlib from functools import wraps +import sys import io import logging import os import tempfile import textwrap import time -from unittest import TestCase -import unittest -from git.compat import string_types, is_win, PY3 +from git.compat import string_types, is_win from git.util import rmtree, cwd import os.path as osp +if sys.version_info[0:2] == (2, 6): + import unittest2 as unittest +else: + import unittest +TestCase = unittest.TestCase ospd = osp.dirname @@ -335,8 +339,11 @@ class TestBase(TestCase): of the project history ( to assure tests don't fail for others ). """ - if not PY3: - assertRaisesRegex = unittest.TestCase.assertRaisesRegexp + # On py26, unittest2 has assertRaisesRegex + # On py3, unittest has assertRaisesRegex + # On py27, we use unittest, which names it differently: + if sys.version_info[0:2] == (2, 7): + assertRaisesRegex = TestCase.assertRaisesRegexp def _small_repo_url(self): """:return" a path to a small, clonable repository""" |