GeezerVison is showing github.com — Fixes to support Python 2.6 again. · gitpython-developers/GitPython@1d68375
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: git/cmd.py +6-2Lines changed: 6 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -812,8 +812,12 @@ def _call_process(self, method, *args, **kwargs): | 812 | 812 | :return: Same as ``execute``""" | 813 | 813 | # Handle optional arguments prior to calling transform_kwargs | 814 | 814 | # otherwise these'll end up in args, which is bad. | 815 | | - _kwargs = {k: v for k, v in kwargs.items() if k in execute_kwargs} | 816 | | - kwargs = {k: v for k, v in kwargs.items() if k not in execute_kwargs} | | 815 | + _kwargs = dict() | | 816 | + for kwarg in execute_kwargs: | | 817 | + try: | | 818 | + _kwargs[kwarg] = kwargs.pop(kwarg) | | 819 | + except KeyError: | | 820 | + pass | 817 | 821 |
| 818 | 822 | insert_after_this_arg = kwargs.pop('insert_kwargs_after', None) | 819 | 823 |
| |
Collapse file Copy file name to clipboardExpand all lines: git/objects/submodule/base.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 38 | 38 | import os | 39 | 39 | import logging | 40 | 40 | import uuid | 41 | | -from unittest.case import SkipTest | | 41 | +try: | | 42 | + from unittest import SkipTest | | 43 | +except ImportError: | | 44 | + from unittest2 import SkipTest | 42 | 45 | from git.util import HIDE_WINDOWS_KNOWN_ERRORS | 43 | 46 | from git.objects.base import IndexObject, Object | 44 | 47 | from git.cmd import Git | |
Collapse file Copy file name to clipboardExpand all lines: git/test/lib/helper.py +10-4Lines changed: 10 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 | from __future__ import print_function | 7 | 7 |
| 8 | 8 | from functools import wraps | | 9 | +import sys | 9 | 10 | import io | 10 | 11 | import logging | 11 | 12 | import os | 12 | 13 | import tempfile | 13 | 14 | import textwrap | 14 | 15 | import time | 15 | | -from unittest import TestCase | 16 | | -import unittest | | 16 | +if sys.version_info[0:2] == (2, 6): | | 17 | + import unittest2 as unittest | | 18 | +else: | | 19 | + import unittest | 17 | 20 |
| 18 | 21 | from git.compat import string_types, is_win, PY3 | 19 | 22 | from git.util import rmtree | 20 | 23 |
| 21 | 24 | import os.path as osp | 22 | 25 |
| | 26 | +TestCase = unittest.TestCase | 23 | 27 |
| 24 | 28 | ospd = osp.dirname | 25 | 29 |
| @@ -329,8 +333,10 @@ class TestBase(TestCase): | 329 | 333 | of the project history ( to assure tests don't fail for others ). | 330 | 334 | """ | 331 | 335 |
| 332 | | - if not PY3: | 333 | | - assertRaisesRegex = unittest.TestCase.assertRaisesRegexp | | 336 | + if sys.version_info[0:2] == (2, 6): | | 337 | + assertRaisesRegex = TestCase.assertRaisesRegex | | 338 | + elif sys.version_info[0:2] == (2, 7): | | 339 | + assertRaisesRegex = TestCase.assertRaisesRegexp | 334 | 340 |
| 335 | 341 | def _small_repo_url(self): | 336 | 342 | """:return" a path to a small, clonable repository""" | |
Collapse file Copy file name to clipboardExpand all lines: git/test/performance/test_odb.py +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 |
| 4 | 4 | import sys | 5 | 5 | from time import time | 6 | | -from unittest.case import skipIf | | 6 | +try: | | 7 | + from unittest import skipIf | | 8 | +except ImportError: | | 9 | + from unittest2 import skipIf | | 10 | + | 7 | 11 |
| 8 | 12 | from git.compat import PY3 | 9 | 13 | from git.util import HIDE_WINDOWS_KNOWN_ERRORS | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_base.py +5-3Lines changed: 5 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | import os | 8 | 8 | import sys | 9 | 9 | import tempfile | 10 | | -from unittest import skipIf | 11 | | - | | 10 | +try: | | 11 | + from unittest import SkipTest, skipIf | | 12 | +except ImportError: | | 13 | + from unittest2 import SkipTest, skipIf | 12 | 14 | import git.objects.base as base | 13 | 15 | from git.test.lib import ( | 14 | 16 | TestBase, | @@ -129,7 +131,7 @@ def test_add_unicode(self, rw_repo): | 129 | 131 | try: | 130 | 132 | file_path.encode(sys.getfilesystemencoding()) | 131 | 133 | except UnicodeEncodeError: | 132 | | - from unittest import SkipTest | | 134 | + | 133 | 135 | raise SkipTest("Environment doesn't support unicode filenames") | 134 | 136 |
| 135 | 137 | with open(file_path, "wb") as fp: | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_index.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 13 | 13 | ) | 14 | 14 | import sys | 15 | 15 | import tempfile | 16 | | -from unittest.case import skipIf | | 16 | +try: | | 17 | + from unittest import skipIf | | 18 | +except ImportError: | | 19 | + from unittest2 import skipIf | 17 | 20 |
| 18 | 21 | from git import ( | 19 | 22 | IndexFile, | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_remote.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 6 | 6 |
| 7 | 7 | import random | 8 | 8 | import tempfile | 9 | | -from unittest.case import skipIf | | 9 | +try: | | 10 | + from unittest import skipIf | | 11 | +except ImportError: | | 12 | + from unittest2 import skipIf | 10 | 13 |
| 11 | 14 | from git import ( | 12 | 15 | RemoteProgress, | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_repo.py +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 | import pickle | 12 | 12 | import sys | 13 | 13 | import tempfile | 14 | | -from unittest.case import skipIf | | 14 | +try: | | 15 | + from unittest import skipIf, SkipTest | | 16 | +except ImportError: | | 17 | + from unittest2 import skipIf, SkipTest | 15 | 18 |
| 16 | 19 | from git import ( | 17 | 20 | InvalidGitRepositoryError, | | 54 | 57 | from git.test.lib import with_rw_directory | 55 | 58 | from git.util import join_path_native, rmtree, rmfile | 56 | 59 | from gitdb.util import bin_to_hex | 57 | | -from unittest import SkipTest | 58 | 60 |
| 59 | 61 | import functools as fnt | 60 | 62 | import os.path as osp | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_submodule.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | # the BSD License: http://www.opensource.org/licenses/bsd-license.php | 3 | 3 | import os | 4 | 4 | import sys | 5 | | -from unittest.case import skipIf | | 5 | +try: | | 6 | + from unittest import skipIf | | 7 | +except ImportError: | | 8 | + from unittest2 import skipIf | 6 | 9 |
| 7 | 10 | import git | 8 | 11 | from git.cmd import Git | |
Collapse file Copy file name to clipboardExpand all lines: git/test/test_tree.py +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | from io import BytesIO | 8 | 8 | import os | 9 | 9 | import sys | 10 | | -from unittest.case import skipIf | | 10 | +try: | | 11 | + from unittest import skipIf | | 12 | +except ImportError: | | 13 | + from unittest2 import skipIf | 11 | 14 |
| 12 | 15 | from git import ( | 13 | 16 | Tree, | |
|