diff options
author | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 12:06:10 +0200 |
---|---|---|
committer | Hugo <hugovk@users.noreply.github.com> | 2018-03-18 22:26:04 +0200 |
commit | 929f3e1e1b664ed8cdef90a40c96804edfd08d59 (patch) | |
tree | 805c06bde21a6c4b3d9defe775527a3773bef3b9 /git | |
parent | 190c04569bd2a29597065222cdcc322ec4f2b374 (diff) | |
download | gitpython-929f3e1e1b664ed8cdef90a40c96804edfd08d59.tar.gz |
Drop support for EOL Python 2.6
Diffstat (limited to 'git')
-rw-r--r-- | git/cmd.py | 5 | ||||
-rw-r--r-- | git/config.py | 2 | ||||
-rw-r--r-- | git/objects/submodule/base.py | 5 | ||||
-rw-r--r-- | git/odict.py | 10 | ||||
-rw-r--r-- | git/test/lib/helper.py | 7 | ||||
-rw-r--r-- | git/test/test_base.py | 5 | ||||
-rw-r--r-- | git/test/test_fun.py | 6 | ||||
-rw-r--r-- | git/test/test_index.py | 13 | ||||
-rw-r--r-- | git/test/test_remote.py | 5 | ||||
-rw-r--r-- | git/test/test_repo.py | 11 | ||||
-rw-r--r-- | git/test/test_submodule.py | 5 | ||||
-rw-r--r-- | git/test/test_tree.py | 5 | ||||
-rw-r--r-- | git/test/test_util.py | 5 | ||||
-rw-r--r-- | git/util.py | 5 |
14 files changed, 15 insertions, 74 deletions
@@ -17,6 +17,7 @@ from subprocess import ( import subprocess import sys import threading +from collections import OrderedDict from textwrap import dedent from git.compat import ( @@ -31,7 +32,6 @@ from git.compat import ( is_win, ) from git.exc import CommandError -from git.odict import OrderedDict from git.util import is_cygwin_git, cygpath, expand_path from .exc import ( @@ -143,8 +143,7 @@ CREATE_NO_WINDOW = 0x08000000 ## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards, # see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP - if is_win and sys.version_info >= (2, 7) - else 0) + if is_win else 0) class Git(LazyMixin): diff --git a/git/config.py b/git/config.py index 3310db89..68d65ae9 100644 --- a/git/config.py +++ b/git/config.py @@ -12,6 +12,7 @@ import inspect import logging import os import re +from collections import OrderedDict from git.compat import ( string_types, @@ -21,7 +22,6 @@ from git.compat import ( with_metaclass, PY3 ) -from git.odict import OrderedDict from git.util import LockFile import os.path as osp diff --git a/git/objects/submodule/base.py b/git/objects/submodule/base.py index 33151217..b53ce3ec 100644 --- a/git/objects/submodule/base.py +++ b/git/objects/submodule/base.py @@ -3,10 +3,7 @@ from io import BytesIO import logging import os import stat -try: - from unittest import SkipTest -except ImportError: - from unittest2 import SkipTest +from unittest import SkipTest import uuid import git diff --git a/git/odict.py b/git/odict.py deleted file mode 100644 index f003d14e..00000000 --- a/git/odict.py +++ /dev/null @@ -1,10 +0,0 @@ -try: - from collections import OrderedDict -except ImportError: - try: - from ordereddict import OrderedDict - except ImportError: - import warnings - warnings.warn("git-python needs the ordereddict module installed in python below 2.6 and below.") - warnings.warn("Using standard dictionary as substitute, and cause reordering when writing git config") - OrderedDict = dict diff --git a/git/test/lib/helper.py b/git/test/lib/helper.py index cb46173d..1c06010f 100644 --- a/git/test/lib/helper.py +++ b/git/test/lib/helper.py @@ -15,6 +15,7 @@ import sys import tempfile import textwrap import time +import unittest from git.compat import string_types, is_win from git.util import rmtree, cwd @@ -23,11 +24,6 @@ import gitdb import os.path as osp -if sys.version_info[0:2] == (2, 6): - import unittest2 as unittest -else: - import unittest - TestCase = unittest.TestCase SkipTest = unittest.SkipTest skipIf = unittest.skipIf @@ -348,7 +344,6 @@ class TestBase(TestCase): of the project history ( to assure tests don't fail for others ). """ - # 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): diff --git a/git/test/test_base.py b/git/test/test_base.py index 69f161be..2132806b 100644 --- a/git/test/test_base.py +++ b/git/test/test_base.py @@ -7,10 +7,7 @@ import os import sys import tempfile -try: - from unittest import SkipTest, skipIf -except ImportError: - from unittest2 import SkipTest, skipIf +from unittest import SkipTest, skipIf from git import ( Blob, diff --git a/git/test/test_fun.py b/git/test/test_fun.py index 5e32a1f9..d5e6e50d 100644 --- a/git/test/test_fun.py +++ b/git/test/test_fun.py @@ -2,11 +2,7 @@ from io import BytesIO from stat import S_IFDIR, S_IFREG, S_IFLNK from os import stat import os.path as osp - -try: - from unittest import skipIf, SkipTest -except ImportError: - from unittest2 import skipIf, SkipTest +from unittest import skipIf, SkipTest from git import Git from git.compat import PY3 diff --git a/git/test/test_index.py b/git/test/test_index.py index 757bec9f..73123d6b 100644 --- a/git/test/test_index.py +++ b/git/test/test_index.py @@ -11,12 +11,8 @@ from stat import ( S_ISLNK, ST_MODE ) -import sys import tempfile -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( IndexFile, @@ -168,9 +164,7 @@ class TestIndex(TestBase): except Exception as ex: msg_py3 = "required argument is not an integer" msg_py2 = "cannot convert argument to integer" - msg_py26 = "unsupported operand type(s) for &: 'str' and 'long'" - assert msg_py2 in str(ex) or msg_py3 in str(ex) or \ - msg_py26 in str(ex), str(ex) + assert msg_py2 in str(ex) or msg_py3 in str(ex) ## 2nd time should not fail due to stray lock file try: @@ -180,9 +174,6 @@ class TestIndex(TestBase): @with_rw_repo('0.1.6') def test_index_file_from_tree(self, rw_repo): - if sys.version_info < (2, 7): - ## Skipped, not `assertRaisesRegexp` in py2.6 - return common_ancestor_sha = "5117c9c8a4d3af19a9958677e45cda9269de1541" cur_sha = "4b43ca7ff72d5f535134241e7c797ddc9c7a3573" other_sha = "39f85c4358b7346fee22169da9cad93901ea9eb9" diff --git a/git/test/test_remote.py b/git/test/test_remote.py index ad9210f6..35924ca2 100644 --- a/git/test/test_remote.py +++ b/git/test/test_remote.py @@ -6,10 +6,7 @@ import random import tempfile -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( RemoteProgress, diff --git a/git/test/test_repo.py b/git/test/test_repo.py index 2c3ad957..6985f254 100644 --- a/git/test/test_repo.py +++ b/git/test/test_repo.py @@ -9,12 +9,8 @@ from io import BytesIO import itertools import os import pickle -import sys import tempfile -try: - from unittest import skipIf, SkipTest -except ImportError: - from unittest2 import skipIf, SkipTest +from unittest import skipIf, SkipTest try: import pathlib @@ -364,9 +360,6 @@ class TestRepo(TestBase): @patch.object(Git, '_call_process') def test_should_display_blame_information(self, git): - if sys.version_info < (2, 7): - ## Skipped, not `assertRaisesRegexp` in py2.6 - return git.return_value = fixture('blame') b = self.rorepo.blame('master', 'lib/git.py') assert_equal(13, len(b)) @@ -792,8 +785,6 @@ class TestRepo(TestBase): def test_repo_odbtype(self): target_type = GitCmdObjectDB - if sys.version_info[:2] < (2, 5): - target_type = GitCmdObjectDB self.assertIsInstance(self.rorepo.odb, target_type) def test_submodules(self): diff --git a/git/test/test_submodule.py b/git/test/test_submodule.py index 5c8a2798..3b15c095 100644 --- a/git/test/test_submodule.py +++ b/git/test/test_submodule.py @@ -3,10 +3,7 @@ # the BSD License: http://www.opensource.org/licenses/bsd-license.php import os import sys -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf import git from git.cmd import Git diff --git a/git/test/test_tree.py b/git/test/test_tree.py index 5fd4d760..f3376e23 100644 --- a/git/test/test_tree.py +++ b/git/test/test_tree.py @@ -6,10 +6,7 @@ from io import BytesIO import sys -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf from git import ( Tree, diff --git a/git/test/test_util.py b/git/test/test_util.py index d30c8376..b7925c84 100644 --- a/git/test/test_util.py +++ b/git/test/test_util.py @@ -6,10 +6,7 @@ import tempfile import time -try: - from unittest import skipIf -except ImportError: - from unittest2 import skipIf +from unittest import skipIf import ddt diff --git a/git/util.py b/git/util.py index 52029fed..688ead39 100644 --- a/git/util.py +++ b/git/util.py @@ -14,10 +14,7 @@ import re import shutil import stat import time -try: - from unittest import SkipTest -except ImportError: - from unittest2 import SkipTest +from unittest import SkipTest from gitdb.util import (# NOQA @IgnorePep8 make_sha, |