| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,9 @@ environment: | |||
| 7 | 7 | matrix: | |
| 8 | 8 | ## MINGW | |
| 9 | 9 | # | |
| 10 | + - PYTHON: "C:\\Python26" | ||
| 11 | + PYTHON_VERSION: "2.6" | ||
| 12 | + GIT_PATH: "%GIT_DAEMON_PATH%" | ||
| 10 | 13 | - PYTHON: "C:\\Python27" | |
| 11 | 14 | PYTHON_VERSION: "2.7" | |
| 12 | 15 | GIT_PATH: "%GIT_DAEMON_PATH%" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,10 +1,14 @@ | |||
| 1 | 1 | language: python | |
| 2 | 2 | python: | |
| 3 | + - "2.6" | ||
| 3 | 4 | - "2.7" | |
| 4 | 5 | - "3.3" | |
| 5 | 6 | - "3.4" | |
| 6 | 7 | - "3.5" | |
| 7 | 8 | # - "pypy" - won't work as smmap doesn't work (see gitdb/.travis.yml for details) | |
| 9 | + #matrix: | ||
| 10 | + # allow_failures: | ||
| 11 | + # - python: "2.6" | ||
| 8 | 12 | git: | |
| 9 | 13 | # a higher depth is needed for most of the tests - must be high enough to not actually be shallow | |
| 10 | 14 | # as we clone our own repository in the process | |
@@ -15,6 +19,7 @@ install: | |||
| 15 | 19 | - git fetch --tags | |
| 16 | 20 | - pip install -r test-requirements.txt | |
| 17 | 21 | - pip install codecov sphinx | |
| 22 | + - if [ "$TRAVIS_PYTHON_VERSION" == '2.6' ]; then pip install unittest2; fi | ||
| 18 | 23 | ||
| 19 | 24 | # generate some reflog as git-python tests need it (in master) | |
| 20 | 25 | - ./init-tests-after-clone.sh | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -140,9 +140,9 @@ def dict_to_slots_and__excluded_are_none(self, d, excluded=()): | |||
| 140 | 140 | CREATE_NO_WINDOW = 0x08000000 | |
| 141 | 141 | ||
| 142 | 142 | ## CREATE_NEW_PROCESS_GROUP is needed to allow killing it afterwards, | |
| 143 | - # seehttps://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal | ||
| 143 | + # see https://docs.python.org/3/library/subprocess.html#subprocess.Popen.send_signal | ||
| 144 | 144 | PROC_CREATIONFLAGS = (CREATE_NO_WINDOW | subprocess.CREATE_NEW_PROCESS_GROUP | |
| 145 | - if is_win | ||
| 145 | + if is_win and sys.version_info >= (2, 7) | ||
| 146 | 146 | else 0) | |
| 147 | 147 | ||
| 148 | 148 | ||
@@ -246,7 +246,7 @@ def __del__(self): | |||
| 246 | 246 | return | |
| 247 | 247 | ||
| 248 | 248 | # can be that nothing really exists anymore ... | |
| 249 | - if os is None or os.kill is None: | ||
| 249 | + if os is None or getattr(os, 'kill', None) is None: | ||
| 250 | 250 | return | |
| 251 | 251 | ||
| 252 | 252 | # try to kill it | |
@@ -832,8 +832,12 @@ def _call_process(self, method, *args, **kwargs): | |||
| 832 | 832 | :return: Same as ``execute``""" | |
| 833 | 833 | # Handle optional arguments prior to calling transform_kwargs | |
| 834 | 834 | # otherwise these'll end up in args, which is bad. | |
| 835 | - _kwargs = {k: v for k, v in kwargs.items() if k in execute_kwargs} | ||
| 836 | - kwargs = {k: v for k, v in kwargs.items() if k not in execute_kwargs} | ||
| 835 | + _kwargs = dict() | ||
| 836 | + for kwarg in execute_kwargs: | ||
| 837 | + try: | ||
| 838 | + _kwargs[kwarg] = kwargs.pop(kwarg) | ||
| 839 | + except KeyError: | ||
| 840 | + pass | ||
| 837 | 841 | ||
| 838 | 842 | insert_after_this_arg = kwargs.pop('insert_kwargs_after', None) | |
| 839 | 843 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,10 @@ | |||
| 3 | 3 | import logging | |
| 4 | 4 | import os | |
| 5 | 5 | import stat | |
| 6 | - from unittest.case import SkipTest | ||
| 6 | + try: | ||
| 7 | + from unittest import SkipTest | ||
| 8 | + except ImportError: | ||
| 9 | + from unittest2 import SkipTest | ||
| 7 | 10 | import uuid | |
| 8 | 11 | ||
| 9 | 12 | import git | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,20 +7,24 @@ | |||
| 7 | 7 | ||
| 8 | 8 | import contextlib | |
| 9 | 9 | from functools import wraps | |
| 10 | + import sys | ||
| 10 | 11 | import io | |
| 11 | 12 | import logging | |
| 12 | 13 | import os | |
| 13 | 14 | import tempfile | |
| 14 | 15 | import textwrap | |
| 15 | 16 | import time | |
| 16 | - from unittest import TestCase | ||
| 17 | - import unittest | ||
| 18 | 17 | ||
| 19 | - from git.compat import string_types, is_win, PY3 | ||
| 18 | + from git.compat import string_types, is_win | ||
| 20 | 19 | from git.util import rmtree, cwd | |
| 21 | 20 | ||
| 22 | 21 | import os.path as osp | |
| 22 | + if sys.version_info[0:2] == (2, 6): | ||
| 23 | + import unittest2 as unittest | ||
| 24 | + else: | ||
| 25 | + import unittest | ||
| 23 | 26 | ||
| 27 | + TestCase = unittest.TestCase | ||
| 24 | 28 | ||
| 25 | 29 | ospd = osp.dirname | |
| 26 | 30 | ||
@@ -335,8 +339,11 @@ class TestBase(TestCase): | |||
| 335 | 339 | of the project history ( to assure tests don't fail for others ). | |
| 336 | 340 | """ | |
| 337 | 341 | ||
| 338 | - if not PY3: | ||
| 339 | - assertRaisesRegex = unittest.TestCase.assertRaisesRegexp | ||
| 342 | + # On py26, unittest2 has assertRaisesRegex | ||
| 343 | + # On py3, unittest has assertRaisesRegex | ||
| 344 | + # On py27, we use unittest, which names it differently: | ||
| 345 | + if sys.version_info[0:2] == (2, 7): | ||
| 346 | + assertRaisesRegex = TestCase.assertRaisesRegexp | ||
| 340 | 347 | ||
| 341 | 348 | def _small_repo_url(self): | |
| 342 | 349 | """:return" a path to a small, clonable repository""" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,7 +7,10 @@ | |||
| 7 | 7 | import os | |
| 8 | 8 | import sys | |
| 9 | 9 | import tempfile | |
| 10 | - from unittest import skipIf | ||
| 10 | + try: | ||
| 11 | + from unittest import SkipTest, skipIf | ||
| 12 | + except ImportError: | ||
| 13 | + from unittest2 import SkipTest, skipIf | ||
| 11 | 14 | ||
| 12 | 15 | from git import ( | |
| 13 | 16 | Blob, | |
@@ -131,7 +134,6 @@ def test_add_unicode(self, rw_repo): | |||
| 131 | 134 | try: | |
| 132 | 135 | file_path.encode(sys.getfilesystemencoding()) | |
| 133 | 136 | except UnicodeEncodeError: | |
| 134 | - from unittest import SkipTest | ||
| 135 | 137 | raise SkipTest("Environment doesn't support unicode filenames") | |
| 136 | 138 | ||
| 137 | 139 | with open(file_path, "wb") as fp: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,9 @@ | |||
| 1 | 1 | from io import BytesIO | |
| 2 | 2 | from stat import S_IFDIR, S_IFREG, S_IFLNK | |
| 3 | - from unittest.case import skipIf | ||
| 3 | + try: | ||
| 4 | + from unittest import skipIf | ||
| 5 | + except ImportError: | ||
| 6 | + from unittest2 import skipIf | ||
| 4 | 7 | ||
| 5 | 8 | from git.compat import PY3 | |
| 6 | 9 | from git.index import IndexFile | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,10 @@ | |||
| 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, | |
@@ -149,8 +152,9 @@ def add_bad_blob(): | |||
| 149 | 152 | except Exception as ex: | |
| 150 | 153 | msg_py3 = "required argument is not an integer" | |
| 151 | 154 | msg_py2 = "cannot convert argument to integer" | |
| 152 | - ## msg_py26 ="unsupported operand type(s) for &: 'str' and 'long'" | ||
| 153 | - assert msg_py2 in str(ex) or msg_py3 in str(ex), str(ex) | ||
| 155 | + msg_py26 = "unsupported operand type(s) for &: 'str' and 'long'" | ||
| 156 | + assert msg_py2 in str(ex) or msg_py3 in str(ex) or \ | ||
| 157 | + msg_py26 in str(ex), str(ex) | ||
| 154 | 158 | ||
| 155 | 159 | ## 2nd time should not fail due to stray lock file | |
| 156 | 160 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,10 @@ | |||
| 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, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,10 @@ | |||
| 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, | |
@@ -53,7 +56,6 @@ | |||
| 53 | 56 | from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath | |
| 54 | 57 | from git.test.lib import with_rw_directory | |
| 55 | 58 | from git.util import join_path_native, rmtree, rmfile, bin_to_hex | |
| 56 | - from unittest import SkipTest | ||
| 57 | 59 | ||
| 58 | 60 | import functools as fnt | |
| 59 | 61 | import os.path as osp | |
| Back | FazBrowse Home | New Git URL |
0 commit comments