diff -Nru python-git-3.0.7/debian/changelog python-git-3.1.1/debian/changelog --- python-git-3.0.7/debian/changelog 2020-02-11 02:45:30.000000000 +0000 +++ python-git-3.1.1/debian/changelog 2020-04-25 04:07:25.000000000 +0000 @@ -1,3 +1,17 @@ +python-git (3.1.1-1) unstable; urgency=medium + + * New upstream version 3.1.1 + + -- TANIGUCHI Takaki Sat, 25 Apr 2020 13:07:25 +0900 + +python-git (3.1.0-1) unstable; urgency=medium + + * New upstream version 3.1.0 + * d/rules: remove python2 code + * Bump Standards-Version to 4.5.0 + + -- TANIGUCHI Takaki Sun, 05 Apr 2020 13:33:25 +0900 + python-git (3.0.7-1) unstable; urgency=medium * New upstream version 3.0.7 diff -Nru python-git-3.0.7/debian/control python-git-3.1.1/debian/control --- python-git-3.0.7/debian/control 2020-02-11 02:45:30.000000000 +0000 +++ python-git-3.1.1/debian/control 2020-04-25 04:07:25.000000000 +0000 @@ -18,7 +18,7 @@ python3-mock, python3-nose, python3-smmap (>= 2), -Standards-Version: 4.4.1 +Standards-Version: 4.5.0 Vcs-Git: https://salsa.debian.org/python-team/modules/python-git.git Vcs-Browser: https://salsa.debian.org/python-team/modules/python-git Homepage: https://github.com/gitpython-developers/GitPython diff -Nru python-git-3.0.7/debian/rules python-git-3.1.1/debian/rules --- python-git-3.0.7/debian/rules 2020-02-11 02:45:30.000000000 +0000 +++ python-git-3.1.1/debian/rules 2020-04-25 04:07:25.000000000 +0000 @@ -1,7 +1,6 @@ #!/usr/bin/make -f # -*- makefile -*- -PYTHONS:=$(shell pyversions -vr) PYTHON3S:=$(shell py3versions -vr) # Run tests only while building for neurodebian (~nd version suffix) docheck = $(shell LC_ALL=C dpkg-parsechangelog | grep '^Version:' | cut -d ' ' -f 2,2 | grep -q -e '~nd' && echo "docheck" || echo "nocheck" ) @@ -18,10 +17,6 @@ endif override_dh_auto_install: - set -e ; for pyvers in $(PYTHONS); do \ - python$$pyvers setup.py install --install-layout=deb \ - --root $(CURDIR)/debian/python-git ; \ - done set -e ; for pyvers in $(PYTHON3S); do \ python$$pyvers setup.py install --install-layout=deb \ --root $(CURDIR)/debian/python3-git ; \ diff -Nru python-git-3.0.7/doc/source/changes.rst python-git-3.1.1/doc/source/changes.rst --- python-git-3.0.7/doc/source/changes.rst 2020-02-08 03:27:27.000000000 +0000 +++ python-git-3.1.1/doc/source/changes.rst 2020-04-11 07:42:16.000000000 +0000 @@ -2,25 +2,75 @@ Changelog ========= -3.0.7 - Bugfixes -================================================= +3.1.1 +===== -* removes python 2 compatibility shims, making GitPython a pure Python 3 library - with all of the python related legacy removed. -* Have a look at the PR, it is a good read on the mistakes made in the course of this, - https://github.com/gitpython-developers/GitPython/pull/979 , please help the maintainers - if you can to prevent accidents like these in future. +* support for PyOxidizer, which previously failed due to usage of `__file__`. -see the following for details: -https://github.com/gitpython-developers/gitpython/milestone/33?closed=1 +See the following for details: +https://github.com/gitpython-developers/gitpython/milestone/36?closed=1 + + +3.1.0 +===== + +* Switched back to using gitdb package as requirement + (`gitdb#59 `_) + +3.0.9 +===== + +* Restricted GitDB (gitdb2) version requirement to < 4 +* Removed old nose library from test requirements + +Bugfixes +-------- + +* Changed to use UTF-8 instead of default encoding when getting information about a symbolic reference + (`#774 `_) +* Fixed decoding of tag object message so as to replace invalid bytes + (`#943 `_) + +3.0.8 +===== +* Added support for Python 3.8 +* Bumped GitDB (gitdb2) version requirement to > 3 -3.0.6 - Bugfixes - unsigned/partial - do not use -================================================= +Bugfixes +-------- -There was an issue with my setup, so things managed to slip to pypi without a signature. +* Fixed Repo.__repr__ when subclassed + (`#968 `_) +* Removed compatibility shims for Python < 3.4 and old mock library +* Replaced usage of deprecated unittest aliases and Logger.warn +* Removed old, no longer used assert methods +* Replaced usage of nose assert methods with unittest -Use 3.0.7 instead. +3.0.7 +===== + +Properly signed re-release of v3.0.6 with new signature +(See `#980 `_) + +3.0.6 +===== + +| Note: There was an issue that caused this version to be released to PyPI without a signature +| See the changelog for v3.0.7 and `#980 `_ + +Bugfixes +-------- + +* Fixed warning for usage of environment variables for paths containing ``$`` or ``%`` + (`#832 `_, + `#961 `_) +* Added support for parsing Git internal date format (@ ) + (`#965 `_) +* Removed Python 2 and < 3.3 compatibility shims + (`#979 `_) +* Fixed GitDB (gitdb2) requirement version specifier formatting in requirements.txt + (`#979 `_) 3.0.5 - Bugfixes ============================================= @@ -74,6 +124,20 @@ or run have a look at the difference between tags v2.1.12 and v3.0.0: https://github.com/gitpython-developers/GitPython/compare/2.1.12...3.0.0. +2.1.15 +====== + +* Fixed GitDB (gitdb2) requirement version specifier formatting in requirements.txt + (Backported from `#979 `_) +* Restricted GitDB (gitdb2) version requirement to < 3 + (`#897 `_) + +2.1.14 +====== + +* Fixed handling of 0 when transforming kwargs into Git command arguments + (Backported from `#899 `_) + 2.1.13 - Bring back Python 2.7 support ====================================== diff -Nru python-git-3.0.7/doc/source/conf.py python-git-3.1.1/doc/source/conf.py --- python-git-3.0.7/doc/source/conf.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/doc/source/conf.py 2020-04-11 05:38:55.000000000 +0000 @@ -42,8 +42,8 @@ master_doc = 'index' # General information about the project. -project = u'GitPython' -copyright = u'Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel' +project = 'GitPython' +copyright = 'Copyright (C) 2008, 2009 Michael Trier and contributors, 2010-2015 Sebastian Thiel' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the diff -Nru python-git-3.0.7/doc/source/intro.rst python-git-3.1.1/doc/source/intro.rst --- python-git-3.0.7/doc/source/intro.rst 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/doc/source/intro.rst 2020-02-23 23:31:24.000000000 +0000 @@ -13,18 +13,14 @@ Requirements ============ -* `Python`_ 3.0 or newer +* `Python`_ >= 3.4 * `Git`_ 1.7.0 or newer It should also work with older versions, but it may be that some operations involving remotes will not work as expected. * `GitDB`_ - a pure python git database implementation -* `Python Nose`_ - used for running the tests -* `Mock by Michael Foord`_ used for tests. Requires version 0.5 .. _Python: https://www.python.org .. _Git: https://git-scm.com/ -.. _Python Nose: https://nose.readthedocs.io/en/latest/ -.. _Mock by Michael Foord: http://www.voidspace.org.uk/python/mock.html .. _GitDB: https://pypi.python.org/pypi/gitdb Installing GitPython @@ -104,9 +100,9 @@ $ cd git-python $ git submodule update --init --recursive -Finally verify the installation by running the `nose powered `_ unit tests:: +Finally verify the installation by running unit tests:: - $ nosetests + $ python -m unittest Questions and Answers ===================== diff -Nru python-git-3.0.7/git/exc.py python-git-3.1.1/git/exc.py --- python-git-3.0.7/git/exc.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/exc.py 2020-04-11 05:38:55.000000000 +0000 @@ -34,8 +34,8 @@ #: A unicode print-format with 2 `%s for `` and the rest, #: e.g. - #: u"'%s' failed%s" - _msg = u"Cmd('%s') failed%s" + #: "'%s' failed%s" + _msg = "Cmd('%s') failed%s" def __init__(self, command, status=None, stderr=None, stdout=None): if not isinstance(command, (tuple, list)): @@ -44,19 +44,19 @@ self.status = status if status: if isinstance(status, Exception): - status = u"%s('%s')" % (type(status).__name__, safe_decode(str(status))) + status = "%s('%s')" % (type(status).__name__, safe_decode(str(status))) else: try: - status = u'exit code(%s)' % int(status) + status = 'exit code(%s)' % int(status) except (ValueError, TypeError): s = safe_decode(str(status)) - status = u"'%s'" % s if isinstance(status, str) else s + status = "'%s'" % s if isinstance(status, str) else s self._cmd = safe_decode(command[0]) - self._cmdline = u' '.join(safe_decode(i) for i in command) - self._cause = status and u" due to: %s" % status or "!" - self.stdout = stdout and u"\n stdout: '%s'" % safe_decode(stdout) or '' - self.stderr = stderr and u"\n stderr: '%s'" % safe_decode(stderr) or '' + self._cmdline = ' '.join(safe_decode(i) for i in command) + self._cause = status and " due to: %s" % status or "!" + self.stdout = stdout and "\n stdout: '%s'" % safe_decode(stdout) or '' + self.stderr = stderr and "\n stderr: '%s'" % safe_decode(stderr) or '' def __str__(self): return (self._msg + "\n cmdline: %s%s%s") % ( @@ -68,7 +68,7 @@ the GIT_PYTHON_GIT_EXECUTABLE environment variable""" def __init__(self, command, cause): super(GitCommandNotFound, self).__init__(command, cause) - self._msg = u"Cmd('%s') not found%s" + self._msg = "Cmd('%s') not found%s" class GitCommandError(CommandError): @@ -118,7 +118,7 @@ def __init__(self, command, status, stderr=None, stdout=None): super(HookExecutionError, self).__init__(command, status, stderr, stdout) - self._msg = u"Hook('%s') failed%s" + self._msg = "Hook('%s') failed%s" class RepositoryDirtyError(GitError): diff -Nru python-git-3.0.7/git/index/base.py python-git-3.1.1/git/index/base.py --- python-git-3.0.7/git/index/base.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/index/base.py 2020-04-11 05:38:55.000000000 +0000 @@ -373,8 +373,8 @@ continue # end check symlink - # resolve globs if possible - if '?' in path or '*' in path or '[' in path: + # if the path is not already pointing to an existing file, resolve globs if possible + if not os.path.exists(path) and ('?' in path or '*' in path or '[' in path): resolved_paths = glob.glob(abs_path) # not abs_path in resolved_paths: # a glob() resolving to the same path we are feeding it with diff -Nru python-git-3.0.7/git/__init__.py python-git-3.1.1/git/__init__.py --- python-git-3.0.7/git/__init__.py 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/git/__init__.py 2020-04-11 07:46:51.000000000 +0000 @@ -12,13 +12,13 @@ import os.path as osp -__version__ = '3.0.7' +__version__ = '3.1.1' #{ Initialization def _init_externals(): """Initialize external projects by putting them into the path""" - if __version__ == '3.0.7': + if __version__ == '3.1.1' and 'PYOXIDIZER' not in os.environ: sys.path.insert(0, osp.join(osp.dirname(__file__), 'ext', 'gitdb')) try: diff -Nru python-git-3.0.7/git/objects/submodule/base.py python-git-3.1.1/git/objects/submodule/base.py --- python-git-3.0.7/git/objects/submodule/base.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/objects/submodule/base.py 2020-04-11 05:38:55.000000000 +0000 @@ -20,7 +20,8 @@ from git.exc import ( InvalidGitRepositoryError, NoSuchPathError, - RepositoryDirtyError + RepositoryDirtyError, + BadName ) from git.objects.base import IndexObject, Object from git.objects.util import Traversable @@ -538,7 +539,7 @@ mrepo.head.set_reference(local_branch, logmsg="submodule: attaching head to %s" % local_branch) mrepo.head.ref.set_tracking_branch(remote_branch) except (IndexError, InvalidGitRepositoryError): - log.warn("Failed to checkout tracking branch %s", self.branch_path) + log.warning("Failed to checkout tracking branch %s", self.branch_path) # END handle tracking branch # NOTE: Have to write the repo config file as well, otherwise @@ -1153,10 +1154,10 @@ @classmethod def iter_items(cls, repo, parent_commit='HEAD'): """:return: iterator yielding Submodule instances available in the given repository""" - pc = repo.commit(parent_commit) # parent commit instance try: + pc = repo.commit(parent_commit) # parent commit instance parser = cls._config_parser(repo, pc, read_only=True) - except IOError: + except (IOError, BadName): return # END handle empty iterator diff -Nru python-git-3.0.7/git/objects/submodule/root.py python-git-3.1.1/git/objects/submodule/root.py --- python-git-3.0.7/git/objects/submodule/root.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/objects/submodule/root.py 2020-02-18 04:23:39.000000000 +0000 @@ -265,7 +265,7 @@ # this way, it will be checked out in the next step # This will change the submodule relative to us, so # the user will be able to commit the change easily - log.warn("Current sha %s was not contained in the tracking\ + log.warning("Current sha %s was not contained in the tracking\ branch at the new remote, setting it the the remote's tracking branch", sm.hexsha) sm.binsha = rref.commit.binsha # END reset binsha diff -Nru python-git-3.0.7/git/objects/tag.py python-git-3.1.1/git/objects/tag.py --- python-git-3.0.7/git/objects/tag.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/objects/tag.py 2020-02-23 23:31:24.000000000 +0000 @@ -50,7 +50,7 @@ """Cache all our attributes at once""" if attr in TagObject.__slots__: ostream = self.repo.odb.stream(self.binsha) - lines = ostream.read().decode(defenc).splitlines() + lines = ostream.read().decode(defenc, 'replace').splitlines() _obj, hexsha = lines[0].split(" ") _type_token, type_name = lines[1].split(" ") diff -Nru python-git-3.0.7/git/refs/log.py python-git-3.1.1/git/refs/log.py --- python-git-3.0.7/git/refs/log.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/refs/log.py 2020-04-11 05:38:55.000000000 +0000 @@ -37,13 +37,13 @@ """:return: a string suitable to be placed in a reflog file""" act = self.actor time = self.time - return u"{} {} {} <{}> {!s} {}\t{}\n".format(self.oldhexsha, - self.newhexsha, - act.name, - act.email, - time[0], - altz_to_utctz_str(time[1]), - self.message) + return "{} {} {} <{}> {!s} {}\t{}\n".format(self.oldhexsha, + self.newhexsha, + act.name, + act.email, + time[0], + altz_to_utctz_str(time[1]), + self.message) @property def oldhexsha(self): diff -Nru python-git-3.0.7/git/refs/symbolic.py python-git-3.1.1/git/refs/symbolic.py --- python-git-3.0.7/git/refs/symbolic.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/refs/symbolic.py 2020-02-23 23:31:24.000000000 +0000 @@ -142,7 +142,7 @@ tokens = None repodir = _git_dir(repo, ref_path) try: - with open(osp.join(repodir, ref_path), 'rt') as fp: + with open(osp.join(repodir, ref_path), 'rt', encoding='UTF-8') as fp: value = fp.read().rstrip() # Don't only split on spaces, but on whitespace, which allows to parse lines like # 60b64ef992065e2600bfef6187a97f92398a9144 branch 'master' of git-server:/path/to/repo diff -Nru python-git-3.0.7/git/remote.py python-git-3.1.1/git/remote.py --- python-git-3.0.7/git/remote.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/remote.py 2020-04-11 07:30:44.000000000 +0000 @@ -751,7 +751,7 @@ finally: config.release() - def fetch(self, refspec=None, progress=None, **kwargs): + def fetch(self, refspec=None, progress=None, verbose=True, **kwargs): """Fetch the latest changes for this remote :param refspec: @@ -770,6 +770,7 @@ underlying git-fetch does) - supplying a list rather than a string for 'refspec' will make use of this facility. :param progress: See 'push' method + :param verbose: Boolean for verbose output :param kwargs: Additional arguments to be passed to git-fetch :return: IterableList(FetchInfo, ...) list of FetchInfo instances providing detailed @@ -788,7 +789,7 @@ args = [refspec] proc = self.repo.git.fetch(self, *args, as_process=True, with_stdout=False, - universal_newlines=True, v=True, **kwargs) + universal_newlines=True, v=verbose, **kwargs) res = self._get_fetch_info_from_stderr(proc, progress) if hasattr(self.repo.odb, 'update_cache'): self.repo.odb.update_cache() diff -Nru python-git-3.0.7/git/repo/base.py python-git-3.1.1/git/repo/base.py --- python-git-3.0.7/git/repo/base.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/repo/base.py 2020-02-25 12:15:28.000000000 +0000 @@ -471,8 +471,10 @@ def commit(self, rev=None): """The Commit object for the specified revision + :param rev: revision specifier, see git-rev-parse for viable options. - :return: ``git.Commit``""" + :return: ``git.Commit`` + """ if rev is None: return self.head.commit return self.rev_parse(str(rev) + "^0") @@ -1057,7 +1059,8 @@ rev_parse = rev_parse def __repr__(self): - return '' % self.git_dir + clazz = self.__class__ + return '<%s.%s %r>' % (clazz.__module__, clazz.__name__, self.git_dir) def currently_rebasing_on(self): """ diff -Nru python-git-3.0.7/git/repo/fun.py python-git-3.1.1/git/repo/fun.py --- python-git-3.0.7/git/repo/fun.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/repo/fun.py 2020-04-11 05:38:55.000000000 +0000 @@ -35,7 +35,8 @@ There is the unlikely danger to throw if we see directories which just look like a worktree dir, but are none.""" if osp.isdir(d): - if osp.isdir(osp.join(d, 'objects')) and osp.isdir(osp.join(d, 'refs')): + if (osp.isdir(osp.join(d, 'objects')) or 'GIT_OBJECT_DIRECTORY' in os.environ) \ + and osp.isdir(osp.join(d, 'refs')): headref = osp.join(d, 'HEAD') return osp.isfile(headref) or \ (osp.islink(headref) and diff -Nru python-git-3.0.7/git/test/lib/asserts.py python-git-3.1.1/git/test/lib/asserts.py --- python-git-3.0.7/git/test/lib/asserts.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/lib/asserts.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -# asserts.py -# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors -# -# This module is part of GitPython and is released under -# the BSD License: http://www.opensource.org/licenses/bsd-license.php - -import re -import stat - -from nose.tools import ( - assert_equal, # @UnusedImport - assert_not_equal, # @UnusedImport - assert_raises, # @UnusedImport - raises, # @UnusedImport - assert_true, # @UnusedImport - assert_false # @UnusedImport -) - -try: - from unittest.mock import patch -except ImportError: - from mock import patch # @NoMove @UnusedImport - -__all__ = ['assert_instance_of', 'assert_not_instance_of', - 'assert_none', 'assert_not_none', - 'assert_match', 'assert_not_match', 'assert_mode_644', - 'assert_mode_755', - 'assert_equal', 'assert_not_equal', 'assert_raises', 'patch', 'raises', - 'assert_true', 'assert_false'] - - -def assert_instance_of(expected, actual, msg=None): - """Verify that object is an instance of expected """ - assert isinstance(actual, expected), msg - - -def assert_not_instance_of(expected, actual, msg=None): - """Verify that object is not an instance of expected """ - assert not isinstance(actual, expected, msg) - - -def assert_none(actual, msg=None): - """verify that item is None""" - assert actual is None, msg - - -def assert_not_none(actual, msg=None): - """verify that item is None""" - assert actual is not None, msg - - -def assert_match(pattern, string, msg=None): - """verify that the pattern matches the string""" - assert_not_none(re.search(pattern, string), msg) - - -def assert_not_match(pattern, string, msg=None): - """verify that the pattern does not match the string""" - assert_none(re.search(pattern, string), msg) - - -def assert_mode_644(mode): - """Verify given mode is 644""" - assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP) - assert (mode & stat.S_IWUSR) and (mode & stat.S_IRUSR) and not (mode & stat.S_IXUSR) - - -def assert_mode_755(mode): - """Verify given mode is 755""" - assert (mode & stat.S_IROTH) and (mode & stat.S_IRGRP) and (mode & stat.S_IXOTH) and (mode & stat.S_IXGRP) - assert (mode & stat.S_IWUSR) and (mode & stat.S_IRUSR) and (mode & stat.S_IXUSR) diff -Nru python-git-3.0.7/git/test/lib/helper.py python-git-3.1.1/git/test/lib/helper.py --- python-git-3.0.7/git/test/lib/helper.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/lib/helper.py 2020-02-18 04:23:39.000000000 +0000 @@ -331,7 +331,7 @@ - Utility functions provided by the TestCase base of the unittest method such as:: self.fail("todo") - self.failUnlessRaises(...) + self.assertRaises(...) - Class level repository which is considered read-only as it is shared among all test cases in your type. diff -Nru python-git-3.0.7/git/test/lib/__init__.py python-git-3.1.1/git/test/lib/__init__.py --- python-git-3.0.7/git/test/lib/__init__.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/lib/__init__.py 2020-02-18 04:23:39.000000000 +0000 @@ -6,7 +6,6 @@ # flake8: noqa import inspect -from .asserts import * from .helper import * __all__ = [name for name, obj in locals().items() diff -Nru python-git-3.0.7/git/test/performance/test_commit.py python-git-3.1.1/git/test/performance/test_commit.py --- python-git-3.0.7/git/test/performance/test_commit.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/performance/test_commit.py 2020-02-18 04:23:39.000000000 +0000 @@ -11,10 +11,10 @@ from .lib import TestBigRepoRW from git import Commit from gitdb import IStream -from git.test.test_commit import assert_commit_serialization +from git.test.test_commit import TestCommitSerialization -class TestPerformance(TestBigRepoRW): +class TestPerformance(TestBigRepoRW, TestCommitSerialization): def tearDown(self): import gc @@ -79,7 +79,7 @@ % (nc, elapsed_time, nc / elapsed_time), file=sys.stderr) def test_commit_serialization(self): - assert_commit_serialization(self.gitrwrepo, '58c78e6', True) + self.assert_commit_serialization(self.gitrwrepo, '58c78e6', True) rwrepo = self.gitrwrepo make_object = rwrepo.odb.store diff -Nru python-git-3.0.7/git/test/test_actor.py python-git-3.1.1/git/test/test_actor.py --- python-git-3.0.7/git/test/test_actor.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_actor.py 2020-02-18 04:23:39.000000000 +0000 @@ -4,16 +4,16 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import assert_equal +from git.test.lib import TestBase from git import Actor -class TestActor(object): +class TestActor(TestBase): def test_from_string_should_separate_name_and_email(self): a = Actor._from_string("Michael Trier ") - assert_equal("Michael Trier", a.name) - assert_equal("mtrier@example.com", a.email) + self.assertEqual("Michael Trier", a.name) + self.assertEqual("mtrier@example.com", a.email) # base type capabilities assert a == a @@ -25,13 +25,13 @@ def test_from_string_should_handle_just_name(self): a = Actor._from_string("Michael Trier") - assert_equal("Michael Trier", a.name) - assert_equal(None, a.email) + self.assertEqual("Michael Trier", a.name) + self.assertEqual(None, a.email) def test_should_display_representation(self): a = Actor._from_string("Michael Trier ") - assert_equal('">', repr(a)) + self.assertEqual('">', repr(a)) def test_str_should_alias_name(self): a = Actor._from_string("Michael Trier ") - assert_equal(a.name, str(a)) + self.assertEqual(a.name, str(a)) diff -Nru python-git-3.0.7/git/test/test_base.py python-git-3.1.1/git/test/test_base.py --- python-git-3.0.7/git/test/test_base.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_base.py 2020-04-11 05:38:55.000000000 +0000 @@ -19,7 +19,6 @@ from git.objects.util import get_object_type_by_name from git.test.lib import ( TestBase, - assert_raises, with_rw_repo, with_rw_and_rw_remote_repo ) @@ -96,7 +95,7 @@ assert base.Object in get_object_type_by_name(tname).mro() # END for each known type - assert_raises(ValueError, get_object_type_by_name, b"doesntexist") + self.assertRaises(ValueError, get_object_type_by_name, b"doesntexist") def test_object_resolution(self): # objects must be resolved to shas so they compare equal @@ -123,7 +122,7 @@ "Unicode woes, see https://github.com/gitpython-developers/GitPython/pull/519") @with_rw_repo('0.1.6') def test_add_unicode(self, rw_repo): - filename = u"שלום.txt" + filename = "שלום.txt" file_path = osp.join(rw_repo.working_dir, filename) diff -Nru python-git-3.0.7/git/test/test_blob.py python-git-3.1.1/git/test/test_blob.py --- python-git-3.0.7/git/test/test_blob.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_blob.py 2020-02-18 04:23:39.000000000 +0000 @@ -4,10 +4,7 @@ # This module is part of GitPython and is released under # the BSD License: http://www.opensource.org/licenses/bsd-license.php -from git.test.lib import ( - TestBase, - assert_equal -) +from git.test.lib import TestBase from git import Blob @@ -15,11 +12,11 @@ def test_mime_type_should_return_mime_type_for_known_types(self): blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'foo.png'}) - assert_equal("image/png", blob.mime_type) + self.assertEqual("image/png", blob.mime_type) def test_mime_type_should_return_text_plain_for_unknown_types(self): blob = Blob(self.rorepo, **{'binsha': Blob.NULL_BIN_SHA, 'path': 'something'}) - assert_equal("text/plain", blob.mime_type) + self.assertEqual("text/plain", blob.mime_type) def test_nodict(self): - self.failUnlessRaises(AttributeError, setattr, self.rorepo.tree()['AUTHORS'], 'someattr', 2) + self.assertRaises(AttributeError, setattr, self.rorepo.tree()['AUTHORS'], 'someattr', 2) diff -Nru python-git-3.0.7/git/test/test_commit.py python-git-3.1.1/git/test/test_commit.py --- python-git-3.0.7/git/test/test_commit.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/test_commit.py 2020-04-11 05:38:55.000000000 +0000 @@ -11,6 +11,7 @@ import re import sys import time +from unittest.mock import Mock from git import ( Commit, @@ -21,8 +22,6 @@ from git.repo.fun import touch from git.test.lib import ( TestBase, - assert_equal, - assert_not_equal, with_rw_repo, fixture_path, StringProcessAdapter @@ -33,74 +32,70 @@ import os.path as osp -try: - from unittest.mock import Mock -except ImportError: - from mock import Mock - - -def assert_commit_serialization(rwrepo, commit_id, print_performance_info=False): - """traverse all commits in the history of commit identified by commit_id and check - if the serialization works. - :param print_performance_info: if True, we will show how fast we are""" - ns = 0 # num serializations - nds = 0 # num deserializations - - st = time.time() - for cm in rwrepo.commit(commit_id).traverse(): - nds += 1 - - # assert that we deserialize commits correctly, hence we get the same - # sha on serialization - stream = BytesIO() - cm._serialize(stream) - ns += 1 - streamlen = stream.tell() - stream.seek(0) - - istream = rwrepo.odb.store(IStream(Commit.type, streamlen, stream)) - assert_equal(istream.hexsha, cm.hexsha.encode('ascii')) - - nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree, - cm.author, cm.authored_date, cm.author_tz_offset, - cm.committer, cm.committed_date, cm.committer_tz_offset, - cm.message, cm.parents, cm.encoding) - - assert_equal(nc.parents, cm.parents) - stream = BytesIO() - nc._serialize(stream) - ns += 1 - streamlen = stream.tell() - stream.seek(0) - - # reuse istream - istream.size = streamlen - istream.stream = stream - istream.binsha = None - nc.binsha = rwrepo.odb.store(istream).binsha - - # if it worked, we have exactly the same contents ! - assert_equal(nc.hexsha, cm.hexsha) - # END check commits - elapsed = time.time() - st - - if print_performance_info: - print("Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s" - % (ns, nds, elapsed, ns / elapsed, nds / elapsed), file=sys.stderr) - # END handle performance info +class TestCommitSerialization(TestBase): + def assert_commit_serialization(self, rwrepo, commit_id, print_performance_info=False): + """traverse all commits in the history of commit identified by commit_id and check + if the serialization works. + :param print_performance_info: if True, we will show how fast we are""" + ns = 0 # num serializations + nds = 0 # num deserializations + + st = time.time() + for cm in rwrepo.commit(commit_id).traverse(): + nds += 1 + + # assert that we deserialize commits correctly, hence we get the same + # sha on serialization + stream = BytesIO() + cm._serialize(stream) + ns += 1 + streamlen = stream.tell() + stream.seek(0) + + istream = rwrepo.odb.store(IStream(Commit.type, streamlen, stream)) + self.assertEqual(istream.hexsha, cm.hexsha.encode('ascii')) + + nc = Commit(rwrepo, Commit.NULL_BIN_SHA, cm.tree, + cm.author, cm.authored_date, cm.author_tz_offset, + cm.committer, cm.committed_date, cm.committer_tz_offset, + cm.message, cm.parents, cm.encoding) + + self.assertEqual(nc.parents, cm.parents) + stream = BytesIO() + nc._serialize(stream) + ns += 1 + streamlen = stream.tell() + stream.seek(0) + + # reuse istream + istream.size = streamlen + istream.stream = stream + istream.binsha = None + nc.binsha = rwrepo.odb.store(istream).binsha + + # if it worked, we have exactly the same contents ! + self.assertEqual(nc.hexsha, cm.hexsha) + # END check commits + elapsed = time.time() - st + + if print_performance_info: + print("Serialized %i and deserialized %i commits in %f s ( (%f, %f) commits / s" + % (ns, nds, elapsed, ns / elapsed, nds / elapsed), file=sys.stderr) + # END handle performance info -class TestCommit(TestBase): + +class TestCommit(TestCommitSerialization): def test_bake(self): commit = self.rorepo.commit('2454ae89983a4496a445ce347d7a41c0bb0ea7ae') # commits have no dict - self.failUnlessRaises(AttributeError, setattr, commit, 'someattr', 1) + self.assertRaises(AttributeError, setattr, commit, 'someattr', 1) commit.author # bake - assert_equal("Sebastian Thiel", commit.author.name) - assert_equal("byronimo@gmail.com", commit.author.email) + self.assertEqual("Sebastian Thiel", commit.author.name) + self.assertEqual("byronimo@gmail.com", commit.author.email) self.assertEqual(commit.author, commit.committer) assert isinstance(commit.authored_date, int) and isinstance(commit.committed_date, int) assert isinstance(commit.author_tz_offset, int) and isinstance(commit.committer_tz_offset, int) @@ -137,9 +132,9 @@ def test_unicode_actor(self): # assure we can parse unicode actors correctly - name = u"Üäöß ÄußÉ" + name = "Üäöß ÄußÉ" self.assertEqual(len(name), 9) - special = Actor._from_string(u"%s " % name) + special = Actor._from_string("%s " % name) self.assertEqual(special.name, name) assert isinstance(special.name, str) @@ -180,7 +175,7 @@ self.assertEqual(next(start.traverse(branch_first=1, predicate=lambda i, d: i == p1)), p1) # traversal should stop when the beginning is reached - self.failUnlessRaises(StopIteration, next, first.traverse()) + self.assertRaises(StopIteration, next, first.traverse()) # parents of the first commit should be empty ( as the only parent has a null # sha ) @@ -206,7 +201,7 @@ def test_iter_items(self): # pretty not allowed - self.failUnlessRaises(ValueError, Commit.iter_items, self.rorepo, 'master', pretty="raw") + self.assertRaises(ValueError, Commit.iter_items, self.rorepo, 'master', pretty="raw") def test_rev_list_bisect_all(self): """ @@ -225,7 +220,7 @@ '933d23bf95a5bd1624fbcdf328d904e1fa173474' ) for sha1, commit in zip(expected_ids, commits): - assert_equal(sha1, commit.hexsha) + self.assertEqual(sha1, commit.hexsha) @with_rw_directory def test_ambiguous_arg_iteration(self, rw_dir): @@ -247,18 +242,18 @@ def test_str(self): commit = Commit(self.rorepo, Commit.NULL_BIN_SHA) - assert_equal(Commit.NULL_HEX_SHA, str(commit)) + self.assertEqual(Commit.NULL_HEX_SHA, str(commit)) def test_repr(self): commit = Commit(self.rorepo, Commit.NULL_BIN_SHA) - assert_equal('' % Commit.NULL_HEX_SHA, repr(commit)) + self.assertEqual('' % Commit.NULL_HEX_SHA, repr(commit)) def test_equality(self): commit1 = Commit(self.rorepo, Commit.NULL_BIN_SHA) commit2 = Commit(self.rorepo, Commit.NULL_BIN_SHA) commit3 = Commit(self.rorepo, "\1" * 20) - assert_equal(commit1, commit2) - assert_not_equal(commit2, commit3) + self.assertEqual(commit1, commit2) + self.assertNotEqual(commit2, commit3) def test_iter_parents(self): # should return all but ourselves, even if skip is defined @@ -277,7 +272,7 @@ @with_rw_repo('HEAD', bare=True) def test_serialization(self, rwrepo): # create all commits of our repo - assert_commit_serialization(rwrepo, '0.1.6') + self.assert_commit_serialization(rwrepo, '0.1.6') def test_serialization_unicode_support(self): self.assertEqual(Commit.default_encoding.lower(), 'utf-8') @@ -288,10 +283,10 @@ assert isinstance(cmt.message, str) # it automatically decodes it as such assert isinstance(cmt.author.name, str) # same here - cmt.message = u"üäêèß" + cmt.message = "üäêèß" self.assertEqual(len(cmt.message), 5) - cmt.author.name = u"äüß" + cmt.author.name = "äüß" self.assertEqual(len(cmt.author.name), 3) cstream = BytesIO() @@ -313,7 +308,7 @@ with open(fixture_path('commit_invalid_data'), 'rb') as fd: cmt._deserialize(fd) - self.assertEqual(cmt.author.name, u'E.Azer Ko�o�o�oculu', cmt.author.name) + self.assertEqual(cmt.author.name, 'E.Azer Ko�o�o�oculu', cmt.author.name) self.assertEqual(cmt.author.email, 'azer@kodfabrik.com', cmt.author.email) def test_gpgsig(self): diff -Nru python-git-3.0.7/git/test/test_db.py python-git-3.1.1/git/test/test_db.py --- python-git-3.0.7/git/test/test_db.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_db.py 2020-02-18 04:23:39.000000000 +0000 @@ -24,4 +24,4 @@ # fails with BadObject for invalid_rev in ("0000", "bad/ref", "super bad"): - self.failUnlessRaises(BadObject, gdb.partial_to_complete_sha_hex, invalid_rev) + self.assertRaises(BadObject, gdb.partial_to_complete_sha_hex, invalid_rev) diff -Nru python-git-3.0.7/git/test/test_diff.py python-git-3.1.1/git/test/test_diff.py --- python-git-3.0.7/git/test/test_diff.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_diff.py 2020-04-11 05:38:55.000000000 +0000 @@ -20,8 +20,6 @@ TestBase, StringProcessAdapter, fixture, - assert_equal, - assert_true, ) from git.test.lib import with_rw_directory @@ -95,23 +93,23 @@ diffs = Diff._index_from_patch_format(self.rorepo, output) self._assert_diff_format(diffs) - assert_equal(1, len(diffs)) - assert_equal(8, len(diffs[0].diff.splitlines())) + self.assertEqual(1, len(diffs)) + self.assertEqual(8, len(diffs[0].diff.splitlines())) def test_diff_with_rename(self): output = StringProcessAdapter(fixture('diff_rename')) diffs = Diff._index_from_patch_format(self.rorepo, output) self._assert_diff_format(diffs) - assert_equal(1, len(diffs)) + self.assertEqual(1, len(diffs)) diff = diffs[0] - assert_true(diff.renamed_file) - assert_true(diff.renamed) - assert_equal(diff.rename_from, u'Jérôme') - assert_equal(diff.rename_to, u'müller') - assert_equal(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me') - assert_equal(diff.raw_rename_to, b'm\xc3\xbcller') + self.assertTrue(diff.renamed_file) + self.assertTrue(diff.renamed) + self.assertEqual(diff.rename_from, 'Jérôme') + self.assertEqual(diff.rename_to, 'müller') + self.assertEqual(diff.raw_rename_from, b'J\xc3\xa9r\xc3\xb4me') + self.assertEqual(diff.raw_rename_to, b'm\xc3\xbcller') assert isinstance(str(diff), str) output = StringProcessAdapter(fixture('diff_rename_raw')) @@ -131,12 +129,12 @@ diffs = Diff._index_from_patch_format(self.rorepo, output) self._assert_diff_format(diffs) - assert_equal(1, len(diffs)) + self.assertEqual(1, len(diffs)) diff = diffs[0] - assert_true(diff.copied_file) - assert_true(diff.a_path, u'test1.txt') - assert_true(diff.b_path, u'test2.txt') + self.assertTrue(diff.copied_file) + self.assertTrue(diff.a_path, 'test1.txt') + self.assertTrue(diff.b_path, 'test2.txt') assert isinstance(str(diff), str) output = StringProcessAdapter(fixture('diff_copied_mode_raw')) @@ -145,25 +143,25 @@ diff = diffs[0] self.assertEqual(diff.change_type, 'C') self.assertEqual(diff.score, 100) - self.assertEqual(diff.a_path, u'test1.txt') - self.assertEqual(diff.b_path, u'test2.txt') + self.assertEqual(diff.a_path, 'test1.txt') + self.assertEqual(diff.b_path, 'test2.txt') self.assertEqual(len(list(diffs.iter_change_type('C'))), 1) def test_diff_with_change_in_type(self): output = StringProcessAdapter(fixture('diff_change_in_type')) diffs = Diff._index_from_patch_format(self.rorepo, output) self._assert_diff_format(diffs) - assert_equal(2, len(diffs)) + self.assertEqual(2, len(diffs)) diff = diffs[0] self.assertIsNotNone(diff.deleted_file) - assert_equal(diff.a_path, 'this') - assert_equal(diff.b_path, 'this') + self.assertEqual(diff.a_path, 'this') + self.assertEqual(diff.b_path, 'this') assert isinstance(str(diff), str) diff = diffs[1] - assert_equal(diff.a_path, None) - assert_equal(diff.b_path, 'this') + self.assertEqual(diff.a_path, None) + self.assertEqual(diff.b_path, 'this') self.assertIsNotNone(diff.new_file) assert isinstance(str(diff), str) @@ -239,29 +237,29 @@ res = Diff._index_from_patch_format(None, output) # The "Additions" - self.assertEqual(res[0].b_path, u'path/ starting with a space') - self.assertEqual(res[1].b_path, u'path/"with-quotes"') - self.assertEqual(res[2].b_path, u"path/'with-single-quotes'") - self.assertEqual(res[3].b_path, u'path/ending in a space ') - self.assertEqual(res[4].b_path, u'path/with\ttab') - self.assertEqual(res[5].b_path, u'path/with\nnewline') - self.assertEqual(res[6].b_path, u'path/with spaces') - self.assertEqual(res[7].b_path, u'path/with-question-mark?') - self.assertEqual(res[8].b_path, u'path/¯\\_(ツ)_|¯') - self.assertEqual(res[9].b_path, u'path/💩.txt') + self.assertEqual(res[0].b_path, 'path/ starting with a space') + self.assertEqual(res[1].b_path, 'path/"with-quotes"') + self.assertEqual(res[2].b_path, "path/'with-single-quotes'") + self.assertEqual(res[3].b_path, 'path/ending in a space ') + self.assertEqual(res[4].b_path, 'path/with\ttab') + self.assertEqual(res[5].b_path, 'path/with\nnewline') + self.assertEqual(res[6].b_path, 'path/with spaces') + self.assertEqual(res[7].b_path, 'path/with-question-mark?') + self.assertEqual(res[8].b_path, 'path/¯\\_(ツ)_|¯') + self.assertEqual(res[9].b_path, 'path/💩.txt') self.assertEqual(res[9].b_rawpath, b'path/\xf0\x9f\x92\xa9.txt') - self.assertEqual(res[10].b_path, u'path/�-invalid-unicode-path.txt') + self.assertEqual(res[10].b_path, 'path/�-invalid-unicode-path.txt') self.assertEqual(res[10].b_rawpath, b'path/\x80-invalid-unicode-path.txt') # The "Moves" # NOTE: The path prefixes a/ and b/ here are legit! We're actually # verifying that it's not "a/a/" that shows up, see the fixture data. - self.assertEqual(res[11].a_path, u'a/with spaces') # NOTE: path a/ here legit! - self.assertEqual(res[11].b_path, u'b/with some spaces') # NOTE: path b/ here legit! - self.assertEqual(res[12].a_path, u'a/ending in a space ') - self.assertEqual(res[12].b_path, u'b/ending with space ') - self.assertEqual(res[13].a_path, u'a/"with-quotes"') - self.assertEqual(res[13].b_path, u'b/"with even more quotes"') + self.assertEqual(res[11].a_path, 'a/with spaces') # NOTE: path a/ here legit! + self.assertEqual(res[11].b_path, 'b/with some spaces') # NOTE: path b/ here legit! + self.assertEqual(res[12].a_path, 'a/ending in a space ') + self.assertEqual(res[12].b_path, 'b/ending with space ') + self.assertEqual(res[13].a_path, 'a/"with-quotes"') + self.assertEqual(res[13].b_path, 'b/"with even more quotes"') def test_diff_patch_format(self): # test all of the 'old' format diffs for completness - it should at least @@ -279,7 +277,7 @@ data = StringProcessAdapter(fixture('diff_file_with_spaces')) diff_index = Diff._index_from_patch_format(self.rorepo, data) self.assertIsNone(diff_index[0].a_path, repr(diff_index[0].a_path)) - self.assertEqual(diff_index[0].b_path, u'file with spaces', repr(diff_index[0].b_path)) + self.assertEqual(diff_index[0].b_path, 'file with spaces', repr(diff_index[0].b_path)) def test_diff_submodule(self): """Test that diff is able to correctly diff commits that cover submodule changes""" diff -Nru python-git-3.0.7/git/test/test_docs.py python-git-3.1.1/git/test/test_docs.py --- python-git-3.0.7/git/test/test_docs.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_docs.py 2020-04-11 07:19:03.000000000 +0000 @@ -232,7 +232,7 @@ # [6-test_references_and_objects] new_tag = repo.create_tag('my_new_tag', message='my message') # You cannot change the commit a tag points to. Tags need to be re-created - self.failUnlessRaises(AttributeError, setattr, new_tag, 'commit', repo.commit('HEAD~1')) + self.assertRaises(AttributeError, setattr, new_tag, 'commit', repo.commit('HEAD~1')) repo.delete_tag(new_tag) # ![6-test_references_and_objects] @@ -320,10 +320,10 @@ self.assertEqual(tree['smmap'], tree / 'smmap') # access by index and by sub-path for entry in tree: # intuitive iteration of tree members print(entry) - blob = tree.trees[0].blobs[0] # let's get a blob in a sub-tree + blob = tree.trees[1].blobs[0] # let's get a blob in a sub-tree assert blob.name assert len(blob.path) < len(blob.abspath) - self.assertEqual(tree.trees[0].name + '/' + blob.name, blob.path) # this is how relative blob path generated + self.assertEqual(tree.trees[1].name + '/' + blob.name, blob.path) # this is how relative blob path generated self.assertEqual(tree[blob.path], blob) # you can use paths like 'dir/file' in tree # ![19-test_references_and_objects] @@ -441,7 +441,7 @@ # [30-test_references_and_objects] # checkout the branch using git-checkout. It will fail as the working tree appears dirty - self.failUnlessRaises(git.GitCommandError, repo.heads.master.checkout) + self.assertRaises(git.GitCommandError, repo.heads.master.checkout) repo.heads.past_branch.checkout() # ![30-test_references_and_objects] diff -Nru python-git-3.0.7/git/test/test_exc.py python-git-3.1.1/git/test/test_exc.py --- python-git-3.0.7/git/test/test_exc.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_exc.py 2020-02-18 04:23:39.000000000 +0000 @@ -92,7 +92,7 @@ if subs is not None: # Substrings (must) already contain opening `'`. subs = "(? 1 - self.failUnlessRaises(ValueError, index.remove, ["/doesnt/exists"]) + self.assertRaises(ValueError, index.remove, ["/doesnt/exists"]) # TEST COMMITTING # commit changed index cur_commit = cur_head.commit - commit_message = u"commit default head by Frèderic Çaufl€" + commit_message = "commit default head by Frèderic Çaufl€" new_commit = index.commit(commit_message, head=False) assert cur_commit != new_commit @@ -500,13 +500,13 @@ # commit with other actor cur_commit = cur_head.commit - my_author = Actor(u"Frèderic Çaufl€", "author@example.com") - my_committer = Actor(u"Committing Frèderic Çaufl€", "committer@example.com") + my_author = Actor("Frèderic Çaufl€", "author@example.com") + my_committer = Actor("Committing Frèderic Çaufl€", "committer@example.com") commit_actor = index.commit(commit_message, author=my_author, committer=my_committer) assert cur_commit != commit_actor - self.assertEqual(commit_actor.author.name, u"Frèderic Çaufl€") + self.assertEqual(commit_actor.author.name, "Frèderic Çaufl€") self.assertEqual(commit_actor.author.email, "author@example.com") - self.assertEqual(commit_actor.committer.name, u"Committing Frèderic Çaufl€") + self.assertEqual(commit_actor.committer.name, "Committing Frèderic Çaufl€") self.assertEqual(commit_actor.committer.email, "committer@example.com") self.assertEqual(commit_actor.message, commit_message) self.assertEqual(commit_actor.parents[0], cur_commit) @@ -516,7 +516,7 @@ # commit with author_date and commit_date cur_commit = cur_head.commit - commit_message = u"commit with dates by Avinash Sajjanshetty" + commit_message = "commit with dates by Avinash Sajjanshetty" new_commit = index.commit(commit_message, author_date="2006-04-07T22:13:13", commit_date="2005-04-07T22:13:13") assert cur_commit != new_commit @@ -571,7 +571,7 @@ self.assertEqual(len(entries), 2) # missing path - self.failUnlessRaises(OSError, index.reset(new_commit).add, ['doesnt/exist/must/raise']) + self.assertRaises(OSError, index.reset(new_commit).add, ['doesnt/exist/must/raise']) # blob from older revision overrides current index revision old_blob = new_commit.parents[0].tree.blobs[0] @@ -584,7 +584,7 @@ # mode 0 not allowed null_hex_sha = Diff.NULL_HEX_SHA null_bin_sha = b"\0" * 20 - self.failUnlessRaises(ValueError, index.reset( + self.assertRaises(ValueError, index.reset( new_commit).add, [BaseIndexEntry((0, null_bin_sha, 0, "doesntmatter"))]) # add new file @@ -595,7 +595,7 @@ self._assert_entries(entries) self._assert_fprogress(entries) self.assertEqual(len(entries), 1) - self.assertNotEquals(entries[0].hexsha, null_hex_sha) + self.assertNotEqual(entries[0].hexsha, null_hex_sha) # add symlink if not is_win: @@ -668,10 +668,10 @@ # END for each renamed item # END move assertion utility - self.failUnlessRaises(ValueError, index.move, ['just_one_path']) + self.assertRaises(ValueError, index.move, ['just_one_path']) # file onto existing file files = ['AUTHORS', 'LICENSE'] - self.failUnlessRaises(GitCommandError, index.move, files) + self.assertRaises(GitCommandError, index.move, files) # again, with force assert_mv_rval(index.move(files, f=True)) @@ -777,7 +777,7 @@ def test_index_single_addremove(self, rw_repo): fp = osp.join(rw_repo.working_dir, 'testfile.txt') with open(fp, 'w') as fs: - fs.write(u'content of testfile') + fs.write('content of testfile') self._assert_entries(rw_repo.index.add(fp)) deleted_files = rw_repo.index.remove(fp) assert deleted_files @@ -826,7 +826,7 @@ # NOTE: fp is not a Unicode object in python 2 (which is the source of the problem) fp = osp.join(rw_dir, 'ø.txt') with open(fp, 'wb') as fs: - fs.write(u'content of ø'.encode('utf-8')) + fs.write('content of ø'.encode('utf-8')) r = Repo.init(rw_dir) r.index.add([fp]) @@ -896,8 +896,8 @@ @with_rw_repo('HEAD', bare=True) def test_commit_msg_hook_success(self, rw_repo): - commit_message = u"commit default head by Frèderic Çaufl€" - from_hook_message = u"from commit-msg" + commit_message = "commit default head by Frèderic Çaufl€" + from_hook_message = "from commit-msg" index = rw_repo.index _make_hook( index.repo.git_dir, @@ -905,7 +905,7 @@ 'printf " {}" >> "$1"'.format(from_hook_message) ) new_commit = index.commit(commit_message) - self.assertEqual(new_commit.message, u"{} {}".format(commit_message, from_hook_message)) + self.assertEqual(new_commit.message, "{} {}".format(commit_message, from_hook_message)) @with_rw_repo('HEAD', bare=True) def test_commit_msg_hook_fail(self, rw_repo): diff -Nru python-git-3.0.7/git/test/test_reflog.py python-git-3.1.1/git/test/test_reflog.py --- python-git-3.0.7/git/test/test_reflog.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_reflog.py 2020-02-18 04:23:39.000000000 +0000 @@ -23,7 +23,7 @@ actor = Actor('name', 'email') msg = "message" - self.failUnlessRaises(ValueError, RefLogEntry.new, nullhexsha, hexsha, 'noactor', 0, 0, "") + self.assertRaises(ValueError, RefLogEntry.new, nullhexsha, hexsha, 'noactor', 0, 0, "") e = RefLogEntry.new(nullhexsha, hexsha, actor, 0, 1, msg) assert e.oldhexsha == nullhexsha @@ -59,11 +59,11 @@ # TODO: Try multiple corrupted ones ! pp = 'reflog_invalid_' for suffix in ('oldsha', 'newsha', 'email', 'date', 'sep'): - self.failUnlessRaises(ValueError, RefLog.from_file, fixture_path(pp + suffix)) + self.assertRaises(ValueError, RefLog.from_file, fixture_path(pp + suffix)) # END for each invalid file # cannot write an uninitialized reflog - self.failUnlessRaises(ValueError, RefLog().write) + self.assertRaises(ValueError, RefLog().write) # test serialize and deserialize - results must match exactly binsha = hex_to_bin(('f' * 40).encode('ascii')) @@ -91,7 +91,7 @@ # index entry # raises on invalid index - self.failUnlessRaises(IndexError, RefLog.entry_at, rlp, 10000) + self.assertRaises(IndexError, RefLog.entry_at, rlp, 10000) # indices can be positive ... assert isinstance(RefLog.entry_at(rlp, 0), RefLogEntry) diff -Nru python-git-3.0.7/git/test/test_refs.py python-git-3.1.1/git/test/test_refs.py --- python-git-3.0.7/git/test/test_refs.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_refs.py 2020-02-18 04:23:39.000000000 +0000 @@ -40,7 +40,7 @@ # END for each type # invalid path - self.failUnlessRaises(ValueError, TagReference, self.rorepo, "refs/invalid/tag") + self.assertRaises(ValueError, TagReference, self.rorepo, "refs/invalid/tag") # works without path check TagReference(self.rorepo, "refs/invalid/tag", check_path=False) @@ -54,7 +54,7 @@ tag_object_refs.append(tag) tagobj = tag.tag # have no dict - self.failUnlessRaises(AttributeError, setattr, tagobj, 'someattr', 1) + self.assertRaises(AttributeError, setattr, tagobj, 'someattr', 1) assert isinstance(tagobj, TagObject) assert tagobj.tag == tag.name assert isinstance(tagobj.tagger, Actor) @@ -63,7 +63,7 @@ assert tagobj.message assert tag.object == tagobj # can't assign the object - self.failUnlessRaises(AttributeError, setattr, tag, 'object', tagobj) + self.assertRaises(AttributeError, setattr, tag, 'object', tagobj) # END if we have a tag object # END for tag in repo-tags assert tag_object_refs @@ -201,7 +201,7 @@ cur_head.reset(new_head_commit, index=True) # index only assert cur_head.reference.commit == new_head_commit - self.failUnlessRaises(ValueError, cur_head.reset, new_head_commit, index=False, working_tree=True) + self.assertRaises(ValueError, cur_head.reset, new_head_commit, index=False, working_tree=True) new_head_commit = new_head_commit.parents[0] cur_head.reset(new_head_commit, index=True, working_tree=True) # index + wt assert cur_head.reference.commit == new_head_commit @@ -211,7 +211,7 @@ cur_head.reset(cur_head, paths="test") cur_head.reset(new_head_commit, paths="lib") # hard resets with paths don't work, its all or nothing - self.failUnlessRaises(GitCommandError, cur_head.reset, new_head_commit, working_tree=True, paths="lib") + self.assertRaises(GitCommandError, cur_head.reset, new_head_commit, working_tree=True, paths="lib") # we can do a mixed reset, and then checkout from the index though cur_head.reset(new_head_commit) @@ -235,7 +235,7 @@ cur_head.reference = curhead_commit assert cur_head.commit == curhead_commit assert cur_head.is_detached - self.failUnlessRaises(TypeError, getattr, cur_head, "reference") + self.assertRaises(TypeError, getattr, cur_head, "reference") # tags are references, hence we can point to them some_tag = rw_repo.tags[0] @@ -248,7 +248,7 @@ cur_head.reference = active_head # type check - self.failUnlessRaises(ValueError, setattr, cur_head, "reference", "that") + self.assertRaises(ValueError, setattr, cur_head, "reference", "that") # head handling commit = 'HEAD' @@ -263,7 +263,7 @@ Head.create(rw_repo, new_name, new_head.commit) # its not fine with a different value - self.failUnlessRaises(OSError, Head.create, rw_repo, new_name, new_head.commit.parents[0]) + self.assertRaises(OSError, Head.create, rw_repo, new_name, new_head.commit.parents[0]) # force it new_head = Head.create(rw_repo, new_name, actual_commit, force=True) @@ -276,7 +276,7 @@ # rename with force tmp_head = Head.create(rw_repo, "tmphead") - self.failUnlessRaises(GitCommandError, tmp_head.rename, new_head) + self.assertRaises(GitCommandError, tmp_head.rename, new_head) tmp_head.rename(new_head, force=True) assert tmp_head == new_head and tmp_head.object == new_head.object @@ -289,12 +289,12 @@ assert tmp_head not in heads and new_head not in heads # force on deletion testing would be missing here, code looks okay though ;) # END for each new head name - self.failUnlessRaises(TypeError, RemoteReference.create, rw_repo, "some_name") + self.assertRaises(TypeError, RemoteReference.create, rw_repo, "some_name") # tag ref tag_name = "5.0.2" TagReference.create(rw_repo, tag_name) - self.failUnlessRaises(GitCommandError, TagReference.create, rw_repo, tag_name) + self.assertRaises(GitCommandError, TagReference.create, rw_repo, tag_name) light_tag = TagReference.create(rw_repo, tag_name, "HEAD~1", force=True) assert isinstance(light_tag, TagReference) assert light_tag.name == tag_name @@ -354,13 +354,13 @@ # setting a non-commit as commit fails, but succeeds as object head_tree = head.commit.tree - self.failUnlessRaises(ValueError, setattr, head, 'commit', head_tree) + self.assertRaises(ValueError, setattr, head, 'commit', head_tree) assert head.commit == old_commit # and the ref did not change # we allow heds to point to any object head.object = head_tree assert head.object == head_tree # cannot query tree as commit - self.failUnlessRaises(TypeError, getattr, head, 'commit') + self.assertRaises(TypeError, getattr, head, 'commit') # set the commit directly using the head. This would never detach the head assert not cur_head.is_detached @@ -397,7 +397,7 @@ # create a new branch that is likely to touch the file we changed far_away_head = rw_repo.create_head("far_head", 'HEAD~100') - self.failUnlessRaises(GitCommandError, far_away_head.checkout) + self.assertRaises(GitCommandError, far_away_head.checkout) assert active_branch == active_branch.checkout(force=True) assert rw_repo.head.reference != far_away_head @@ -408,7 +408,7 @@ assert ref.path == full_ref assert ref.object == rw_repo.head.commit - self.failUnlessRaises(OSError, Reference.create, rw_repo, full_ref, 'HEAD~20') + self.assertRaises(OSError, Reference.create, rw_repo, full_ref, 'HEAD~20') # it works if it is at the same spot though and points to the same reference assert Reference.create(rw_repo, full_ref, 'HEAD').path == full_ref Reference.delete(rw_repo, full_ref) @@ -434,11 +434,11 @@ # END for each name type # References that don't exist trigger an error if we want to access them - self.failUnlessRaises(ValueError, getattr, Reference(rw_repo, "refs/doesntexist"), 'commit') + self.assertRaises(ValueError, getattr, Reference(rw_repo, "refs/doesntexist"), 'commit') # exists, fail unless we force ex_ref_path = far_away_head.path - self.failUnlessRaises(OSError, ref.rename, ex_ref_path) + self.assertRaises(OSError, ref.rename, ex_ref_path) # if it points to the same commit it works far_away_head.commit = ref.commit ref.rename(ex_ref_path) @@ -451,7 +451,7 @@ assert symref.path == symref_path assert symref.reference == cur_head.reference - self.failUnlessRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference.commit) + self.assertRaises(OSError, SymbolicReference.create, rw_repo, symref_path, cur_head.reference.commit) # it works if the new ref points to the same reference SymbolicReference.create(rw_repo, symref.path, symref.reference).path == symref.path # @NoEffect SymbolicReference.delete(rw_repo, symref) @@ -541,7 +541,7 @@ # if the assignment raises, the ref doesn't exist Reference.delete(ref.repo, ref.path) assert not ref.is_valid() - self.failUnlessRaises(ValueError, setattr, ref, 'commit', "nonsense") + self.assertRaises(ValueError, setattr, ref, 'commit', "nonsense") assert not ref.is_valid() # I am sure I had my reason to make it a class method at first, but @@ -555,7 +555,7 @@ Reference.delete(ref.repo, ref.path) assert not ref.is_valid() - self.failUnlessRaises(ValueError, setattr, ref, 'object', "nonsense") + self.assertRaises(ValueError, setattr, ref, 'object', "nonsense") assert not ref.is_valid() # END for each path diff -Nru python-git-3.0.7/git/test/test_remote.py python-git-3.1.1/git/test/test_remote.py --- python-git-3.0.7/git/test/test_remote.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/test_remote.py 2020-02-18 04:23:39.000000000 +0000 @@ -27,8 +27,7 @@ with_rw_repo, with_rw_and_rw_remote_repo, fixture, - GIT_DAEMON_PORT, - assert_raises + GIT_DAEMON_PORT ) from git.util import rmtree, HIDE_WINDOWS_FREEZE_ERRORS import os.path as osp @@ -152,8 +151,8 @@ # END for each info def _do_test_fetch_info(self, repo): - self.failUnlessRaises(ValueError, FetchInfo._from_line, repo, "nonsense", '') - self.failUnlessRaises( + self.assertRaises(ValueError, FetchInfo._from_line, repo, "nonsense", '') + self.assertRaises( ValueError, FetchInfo._from_line, repo, "? [up to date] 0.1.7RC -> origin/0.1.7RC", '') def _commit_random_file(self, repo): @@ -221,7 +220,7 @@ Head.delete(new_remote_branch.repo, new_remote_branch) res = fetch_and_test(remote) # deleted remote will not be fetched - self.failUnlessRaises(IndexError, get_info, res, remote, new_remote_branch) + self.assertRaises(IndexError, get_info, res, remote, new_remote_branch) # prune stale tracking branches stale_refs = remote.stale_refs @@ -267,7 +266,7 @@ # delete remote tag - local one will stay TagReference.delete(remote_repo, rtag) res = fetch_and_test(remote, tags=True) - self.failUnlessRaises(IndexError, get_info, res, remote, str(rtag)) + self.assertRaises(IndexError, get_info, res, remote, str(rtag)) # provoke to receive actual objects to see what kind of output we have to # expect. For that we need a remote transport protocol @@ -318,7 +317,7 @@ # push without spec should fail ( without further configuration ) # well, works nicely - # self.failUnlessRaises(GitCommandError, remote.push) + # self.assertRaises(GitCommandError, remote.push) # simple file push self._commit_random_file(rw_repo) @@ -342,7 +341,7 @@ self._do_test_push_result(res, remote) # invalid refspec - self.failUnlessRaises(GitCommandError, remote.push, "hellothere") + self.assertRaises(GitCommandError, remote.push, "hellothere") # push new tags progress = TestRemoteProgress() @@ -439,7 +438,7 @@ assert reader.get_value(opt, None) == val # unable to write with a reader - self.failUnlessRaises(IOError, reader.set, opt, "test") + self.assertRaises(IOError, reader.set, opt, "test") # change value with remote.config_writer as writer: @@ -510,7 +509,7 @@ self.assertTrue(remote.exists()) # create same one again - self.failUnlessRaises(GitCommandError, Remote.create, bare_rw_repo, *arg_list) + self.assertRaises(GitCommandError, Remote.create, bare_rw_repo, *arg_list) Remote.remove(bare_rw_repo, new_name) self.assertTrue(remote.exists()) # We still have a cache that doesn't know we were deleted by name @@ -532,9 +531,9 @@ fetch_info_line_fmt += "git://github.com/gitpython-developers/GitPython" remote_info_line_fmt = "* [new branch] nomatter -> %s" - self.failUnlessRaises(ValueError, FetchInfo._from_line, self.rorepo, - remote_info_line_fmt % "refs/something/branch", - "269c498e56feb93e408ed4558c8138d750de8893\t\t/Users/ben/test/foo\n") + self.assertRaises(ValueError, FetchInfo._from_line, self.rorepo, + remote_info_line_fmt % "refs/something/branch", + "269c498e56feb93e408ed4558c8138d750de8893\t\t/Users/ben/test/foo\n") fi = FetchInfo._from_line(self.rorepo, remote_info_line_fmt % "local/master", @@ -626,7 +625,7 @@ self.assertEqual(list(remote.urls), [test1, test2]) # will raise: fatal: --add --delete doesn't make sense - assert_raises(GitCommandError, remote.set_url, test2, add=True, delete=True) + self.assertRaises(GitCommandError, remote.set_url, test2, add=True, delete=True) # Testing on another remote, with the add/delete URL remote = rw_repo.create_remote('another', url=test1) @@ -640,7 +639,7 @@ remote.delete_url(test1) self.assertEqual(list(remote.urls), [test3]) # will raise fatal: Will not delete all non-push URLs - assert_raises(GitCommandError, remote.delete_url, test3) + self.assertRaises(GitCommandError, remote.delete_url, test3) def test_fetch_error(self): rem = self.rorepo.remote('origin') diff -Nru python-git-3.0.7/git/test/test_repo.py python-git-3.1.1/git/test/test_repo.py --- python-git-3.0.7/git/test/test_repo.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/test_repo.py 2020-04-11 05:38:55.000000000 +0000 @@ -9,14 +9,10 @@ from io import BytesIO import itertools import os +import pathlib import pickle import tempfile -from unittest import skipIf, SkipTest - -try: - import pathlib -except ImportError: - pathlib = None +from unittest import mock, skipIf, SkipTest from git import ( InvalidGitRepositoryError, @@ -41,14 +37,9 @@ ) from git.repo.fun import touch from git.test.lib import ( - patch, TestBase, with_rw_repo, - fixture, - assert_false, - assert_equal, - assert_true, - raises + fixture ) from git.util import HIDE_WINDOWS_KNOWN_ERRORS, cygpath from git.test.lib import with_rw_directory @@ -87,13 +78,11 @@ import gc gc.collect() - @raises(InvalidGitRepositoryError) def test_new_should_raise_on_invalid_repo_location(self): - Repo(tempfile.gettempdir()) + self.assertRaises(InvalidGitRepositoryError, Repo, tempfile.gettempdir()) - @raises(NoSuchPathError) def test_new_should_raise_on_non_existent_path(self): - Repo("repos/foobar") + self.assertRaises(NoSuchPathError, Repo, "repos/foobar") @with_rw_repo('0.3.2.1') def test_repo_creation_from_different_paths(self, rw_repo): @@ -105,20 +94,17 @@ @with_rw_repo('0.3.2.1') def test_repo_creation_pathlib(self, rw_repo): - if pathlib is None: # pythons bellow 3.4 don't have pathlib - raise SkipTest("pathlib was introduced in 3.4") - r_from_gitdir = Repo(pathlib.Path(rw_repo.git_dir)) self.assertEqual(r_from_gitdir.git_dir, rw_repo.git_dir) def test_description(self): txt = "Test repository" self.rorepo.description = txt - assert_equal(self.rorepo.description, txt) + self.assertEqual(self.rorepo.description, txt) def test_heads_should_return_array_of_head_objects(self): for head in self.rorepo.heads: - assert_equal(Head, head.__class__) + self.assertEqual(Head, head.__class__) def test_heads_should_populate_head_data(self): for head in self.rorepo.heads: @@ -136,7 +122,7 @@ self.assertEqual(self.rorepo.tree(tree), tree) # try from invalid revision that does not exist - self.failUnlessRaises(BadName, self.rorepo.tree, 'hello world') + self.assertRaises(BadName, self.rorepo.tree, 'hello world') def test_pickleable(self): pickle.loads(pickle.dumps(self.rorepo)) @@ -152,18 +138,18 @@ self.assertEqual(len(commits), mc) c = commits[0] - assert_equal('9a4b1d4d11eee3c5362a4152216376e634bd14cf', c.hexsha) - assert_equal(["c76852d0bff115720af3f27acdb084c59361e5f6"], [p.hexsha for p in c.parents]) - assert_equal("ce41fc29549042f1aa09cc03174896cf23f112e3", c.tree.hexsha) - assert_equal("Michael Trier", c.author.name) - assert_equal("mtrier@gmail.com", c.author.email) - assert_equal(1232829715, c.authored_date) - assert_equal(5 * 3600, c.author_tz_offset) - assert_equal("Michael Trier", c.committer.name) - assert_equal("mtrier@gmail.com", c.committer.email) - assert_equal(1232829715, c.committed_date) - assert_equal(5 * 3600, c.committer_tz_offset) - assert_equal("Bumped version 0.1.6\n", c.message) + self.assertEqual('9a4b1d4d11eee3c5362a4152216376e634bd14cf', c.hexsha) + self.assertEqual(["c76852d0bff115720af3f27acdb084c59361e5f6"], [p.hexsha for p in c.parents]) + self.assertEqual("ce41fc29549042f1aa09cc03174896cf23f112e3", c.tree.hexsha) + self.assertEqual("Michael Trier", c.author.name) + self.assertEqual("mtrier@gmail.com", c.author.email) + self.assertEqual(1232829715, c.authored_date) + self.assertEqual(5 * 3600, c.author_tz_offset) + self.assertEqual("Michael Trier", c.committer.name) + self.assertEqual("mtrier@gmail.com", c.committer.email) + self.assertEqual(1232829715, c.committed_date) + self.assertEqual(5 * 3600, c.committer_tz_offset) + self.assertEqual("Bumped version 0.1.6\n", c.message) c = commits[1] self.assertIsInstance(c.parents, tuple) @@ -211,7 +197,7 @@ cloned = Repo.clone_from(original_repo.git_dir, osp.join(rw_dir, "clone"), env=environment) - assert_equal(environment, cloned.git.environment()) + self.assertEqual(environment, cloned.git.environment()) @with_rw_directory def test_date_format(self, rw_dir): @@ -221,18 +207,12 @@ @with_rw_directory def test_clone_from_pathlib(self, rw_dir): - if pathlib is None: # pythons bellow 3.4 don't have pathlib - raise SkipTest("pathlib was introduced in 3.4") - original_repo = Repo.init(osp.join(rw_dir, "repo")) Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib") @with_rw_directory def test_clone_from_pathlib_withConfig(self, rw_dir): - if pathlib is None: # pythons bellow 3.4 don't have pathlib - raise SkipTest("pathlib was introduced in 3.4") - original_repo = Repo.init(osp.join(rw_dir, "repo")) cloned = Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib_withConfig", @@ -240,9 +220,9 @@ "--config core.filemode=false", "--config submodule.repo.update=checkout"]) - assert_equal(cloned.config_reader().get_value('submodule', 'active'), 'repo') - assert_equal(cloned.config_reader().get_value('core', 'filemode'), False) - assert_equal(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout') + self.assertEqual(cloned.config_reader().get_value('submodule', 'active'), 'repo') + self.assertEqual(cloned.config_reader().get_value('core', 'filemode'), False) + self.assertEqual(cloned.config_reader().get_value('submodule "repo"', 'update'), 'checkout') def test_clone_from_with_path_contains_unicode(self): with tempfile.TemporaryDirectory() as tmpdir: @@ -260,12 +240,12 @@ @with_rw_repo('HEAD') def test_max_chunk_size(self, repo): - class TestOutputStream(object): + class TestOutputStream(TestBase): def __init__(self, max_chunk_size): self.max_chunk_size = max_chunk_size def write(self, b): - assert_true(len(b) <= self.max_chunk_size) + self.assertTrue(len(b) <= self.max_chunk_size) for chunk_size in [16, 128, 1024]: repo.git.status(output_stream=TestOutputStream(chunk_size), max_chunk_size=chunk_size) @@ -355,12 +335,12 @@ self.rorepo.alternates = cur_alternates def test_repr(self): - assert repr(self.rorepo).startswith('= 2 # gitdb and async [and smmap], async being a child of gitdb # cannot set the parent commit as root module's path didn't exist - self.failUnlessRaises(ValueError, rm.set_parent_commit, 'HEAD') + self.assertRaises(ValueError, rm.set_parent_commit, 'HEAD') # TEST UPDATE ############# @@ -485,7 +485,7 @@ # move it properly - doesn't work as it its path currently points to an indexentry # which doesn't exist ( move it to some path, it doesn't matter here ) - self.failUnlessRaises(InvalidGitRepositoryError, sm.move, pp) + self.assertRaises(InvalidGitRepositoryError, sm.move, pp) # reset the path(cache) to where it was, now it works sm.path = prep sm.move(fp, module=False) # leave it at the old location @@ -535,7 +535,7 @@ # when removing submodules, we may get new commits as nested submodules are auto-committing changes # to allow deletions without force, as the index would be dirty otherwise. # QUESTION: Why does this seem to work in test_git_submodule_compatibility() ? - self.failUnlessRaises(InvalidGitRepositoryError, rm.update, recursive=False, force_remove=False) + self.assertRaises(InvalidGitRepositoryError, rm.update, recursive=False, force_remove=False) rm.update(recursive=False, force_remove=True) assert not osp.isdir(smp) @@ -643,9 +643,9 @@ rwrepo.index.commit("Added submodule " + sm_name) # end for each submodule path to add - self.failUnlessRaises(ValueError, rwrepo.create_submodule, 'fail', osp.expanduser('~')) - self.failUnlessRaises(ValueError, rwrepo.create_submodule, 'fail-too', - rwrepo.working_tree_dir + osp.sep) + self.assertRaises(ValueError, rwrepo.create_submodule, 'fail', osp.expanduser('~')) + self.assertRaises(ValueError, rwrepo.create_submodule, 'fail-too', + rwrepo.working_tree_dir + osp.sep) @with_rw_directory def test_add_empty_repo(self, rwdir): @@ -656,8 +656,8 @@ for checkout_mode in range(2): name = 'empty' + str(checkout_mode) - self.failUnlessRaises(ValueError, parent.create_submodule, name, name, - url=empty_repo_dir, no_checkout=checkout_mode and True or False) + self.assertRaises(ValueError, parent.create_submodule, name, name, + url=empty_repo_dir, no_checkout=checkout_mode and True or False) # end for each checkout mode @with_rw_directory @@ -789,7 +789,7 @@ assert_exists(csm) # Fails because there are new commits, compared to the remote we cloned from - self.failUnlessRaises(InvalidGitRepositoryError, sm.remove, dry_run=True) + self.assertRaises(InvalidGitRepositoryError, sm.remove, dry_run=True) assert_exists(sm) assert sm.module().commit() == sm_head_commit assert_exists(csm) @@ -811,7 +811,7 @@ csm.repo.index.commit("Have to commit submodule change for algorithm to pick it up") assert csm.url == 'bar' - self.failUnlessRaises(Exception, rsm.update, recursive=True, to_latest_revision=True, progress=prog) + self.assertRaises(Exception, rsm.update, recursive=True, to_latest_revision=True, progress=prog) assert_exists(csm) rsm.update(recursive=True, to_latest_revision=True, progress=prog, keep_going=True) @@ -922,7 +922,7 @@ sm_mod.head.ref.name == sm_pfb.name, "should have been switched to past head" sm_mod.commit() == sm_fb.commit, "Head wasn't reset" - self.failUnlessRaises(RepositoryDirtyError, parent_repo.submodule_update, to_latest_revision=True) + self.assertRaises(RepositoryDirtyError, parent_repo.submodule_update, to_latest_revision=True) parent_repo.submodule_update(to_latest_revision=True, force_reset=True) assert sm_mod.commit() == sm_pfb.commit, "Now head should have been reset" assert sm_mod.head.ref.name == sm_pfb.name diff -Nru python-git-3.0.7/git/test/test_tree.py python-git-3.1.1/git/test/test_tree.py --- python-git-3.0.7/git/test/test_tree.py 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/git/test/test_tree.py 2020-02-18 04:23:39.000000000 +0000 @@ -34,7 +34,7 @@ # END skip non-trees tree = item # trees have no dict - self.failUnlessRaises(AttributeError, setattr, tree, 'someattr', 1) + self.assertRaises(AttributeError, setattr, tree, 'someattr', 1) orig_data = tree.data_stream.read() orig_cache = tree._cache diff -Nru python-git-3.0.7/git/test/test_util.py python-git-3.1.1/git/test/test_util.py --- python-git-3.0.7/git/test/test_util.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/test/test_util.py 2020-02-18 04:23:39.000000000 +0000 @@ -21,10 +21,7 @@ parse_date, tzoffset, from_timestamp) -from git.test.lib import ( - TestBase, - assert_equal -) +from git.test.lib import TestBase from git.util import ( LockFile, BlockingLockFile, @@ -126,8 +123,8 @@ self.assertEqual(wcpath, wpath.replace('/', '\\'), cpath) def test_it_should_dashify(self): - assert_equal('this-is-my-argument', dashify('this_is_my_argument')) - assert_equal('foo', dashify('foo')) + self.assertEqual('this-is-my-argument', dashify('this_is_my_argument')) + self.assertEqual('foo', dashify('foo')) def test_lock_file(self): my_file = tempfile.mktemp() @@ -143,13 +140,13 @@ # concurrent access other_lock_file = LockFile(my_file) assert not other_lock_file._has_lock() - self.failUnlessRaises(IOError, other_lock_file._obtain_lock_or_raise) + self.assertRaises(IOError, other_lock_file._obtain_lock_or_raise) lock_file._release_lock() assert not lock_file._has_lock() other_lock_file._obtain_lock_or_raise() - self.failUnlessRaises(IOError, lock_file._obtain_lock_or_raise) + self.assertRaises(IOError, lock_file._obtain_lock_or_raise) # auto-release on destruction del(other_lock_file) @@ -165,7 +162,7 @@ start = time.time() wait_time = 0.1 wait_lock = BlockingLockFile(my_file, 0.05, wait_time) - self.failUnlessRaises(IOError, wait_lock._obtain_lock) + self.assertRaises(IOError, wait_lock._obtain_lock) elapsed = time.time() - start extra_time = 0.02 if is_win: @@ -203,9 +200,9 @@ # END for each date type # and failure - self.failUnlessRaises(ValueError, parse_date, 'invalid format') - self.failUnlessRaises(ValueError, parse_date, '123456789 -02000') - self.failUnlessRaises(ValueError, parse_date, ' 123456789 -0200') + self.assertRaises(ValueError, parse_date, 'invalid format') + self.assertRaises(ValueError, parse_date, '123456789 -02000') + self.assertRaises(ValueError, parse_date, ' 123456789 -0200') def test_actor(self): for cr in (None, self.rorepo.config_reader()): @@ -253,11 +250,11 @@ self.assertIs(ilist.two, m2) # test exceptions - self.failUnlessRaises(AttributeError, getattr, ilist, 'something') - self.failUnlessRaises(IndexError, ilist.__getitem__, 'something') + self.assertRaises(AttributeError, getattr, ilist, 'something') + self.assertRaises(IndexError, ilist.__getitem__, 'something') # delete by name and index - self.failUnlessRaises(IndexError, ilist.__delitem__, 'something') + self.assertRaises(IndexError, ilist.__delitem__, 'something') del(ilist[name2]) self.assertEqual(len(ilist), 1) self.assertNotIn(name2, ilist) @@ -266,8 +263,8 @@ self.assertNotIn(name1, ilist) self.assertEqual(len(ilist), 0) - self.failUnlessRaises(IndexError, ilist.__delitem__, 0) - self.failUnlessRaises(IndexError, ilist.__delitem__, 'something') + self.assertRaises(IndexError, ilist.__delitem__, 0) + self.assertRaises(IndexError, ilist.__delitem__, 'something') def test_from_timestamp(self): # Correct offset: UTC+2, should return datetime + tzoffset(+2) diff -Nru python-git-3.0.7/git/util.py python-git-3.1.1/git/util.py --- python-git-3.0.7/git/util.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/git/util.py 2020-04-11 05:38:55.000000000 +0000 @@ -174,7 +174,7 @@ path = osp.dirname(path) # END handle file if not osp.isdir(path): - os.makedirs(path) + os.makedirs(path, exist_ok=True) return True return False @@ -555,7 +555,7 @@ return self.name def __repr__(self): - return u'">' % (self.name, self.email) + return '">' % (self.name, self.email) @classmethod def _from_string(cls, string): diff -Nru python-git-3.0.7/GitPython.egg-info/PKG-INFO python-git-3.1.1/GitPython.egg-info/PKG-INFO --- python-git-3.0.7/GitPython.egg-info/PKG-INFO 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/GitPython.egg-info/PKG-INFO 2020-04-11 07:46:51.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: GitPython -Version: 3.0.7 +Version: 3.1.1 Summary: Python Git Library Home-page: https://github.com/gitpython-developers/GitPython Author: Sebastian Thiel, Michael Trier @@ -22,4 +22,5 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Requires-Python: >=3.4 diff -Nru python-git-3.0.7/GitPython.egg-info/requires.txt python-git-3.1.1/GitPython.egg-info/requires.txt --- python-git-3.0.7/GitPython.egg-info/requires.txt 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/GitPython.egg-info/requires.txt 2020-04-11 07:46:51.000000000 +0000 @@ -1 +1 @@ -gitdb2>=2.0.0 +gitdb<5,>=4.0.1 diff -Nru python-git-3.0.7/GitPython.egg-info/SOURCES.txt python-git-3.1.1/GitPython.egg-info/SOURCES.txt --- python-git-3.0.7/GitPython.egg-info/SOURCES.txt 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/GitPython.egg-info/SOURCES.txt 2020-04-11 07:46:51.000000000 +0000 @@ -6,7 +6,6 @@ README.md VERSION requirements.txt -setup.cfg setup.py test-requirements.txt GitPython.egg-info/PKG-INFO @@ -153,7 +152,6 @@ git/test/fixtures/uncommon_branch_prefix_FETCH_HEAD git/test/fixtures/uncommon_branch_prefix_stderr git/test/lib/__init__.py -git/test/lib/asserts.py git/test/lib/helper.py git/test/performance/__init__.py git/test/performance/lib.py diff -Nru python-git-3.0.7/PKG-INFO python-git-3.1.1/PKG-INFO --- python-git-3.0.7/PKG-INFO 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/PKG-INFO 2020-04-11 07:46:51.000000000 +0000 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: GitPython -Version: 3.0.7 +Version: 3.1.1 Summary: Python Git Library Home-page: https://github.com/gitpython-developers/GitPython Author: Sebastian Thiel, Michael Trier @@ -22,4 +22,5 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Classifier: Programming Language :: Python :: 3.8 Requires-Python: >=3.4 diff -Nru python-git-3.0.7/README.md python-git-3.1.1/README.md --- python-git-3.0.7/README.md 2020-02-05 05:57:34.000000000 +0000 +++ python-git-3.1.1/README.md 2020-04-11 05:38:55.000000000 +0000 @@ -19,7 +19,7 @@ the `GIT_PYTHON_GIT_EXECUTABLE=` environment variable. * Git (1.7.x or newer) -* Python 3 to 3.7. +* Python >= 3.4 The list of dependencies are listed in `./requirements.txt` and `./test-requirements.txt`. The installer takes care of installing them for you. @@ -87,7 +87,7 @@ tox -For more fine-grained control, you can use `nose`. +For more fine-grained control, you can use `unittest`. ### Contributions @@ -186,19 +186,16 @@ ### DEVELOPMENT STATUS -[![codecov](https://codecov.io/gh/gitpython-developers/GitPython/branch/master/graph/badge.svg)](https://codecov.io/gh/gitpython-developers/GitPython) -[![Build Status](https://travis-ci.org/gitpython-developers/GitPython.svg)](https://travis-ci.org/gitpython-developers/GitPython) -[![Code Climate](https://codeclimate.com/github/gitpython-developers/GitPython/badges/gpa.svg)](https://codeclimate.com/github/gitpython-developers/GitPython) +![Python package](https://github.com/gitpython-developers/GitPython/workflows/Python%20package/badge.svg) [![Documentation Status](https://readthedocs.org/projects/gitpython/badge/?version=stable)](https://readthedocs.org/projects/gitpython/?badge=stable) -[![Stories in Ready](https://badge.waffle.io/gitpython-developers/GitPython.png?label=ready&title=Ready)](https://waffle.io/gitpython-developers/GitPython) [![Packaging status](https://repology.org/badge/tiny-repos/python:gitpython.svg)](https://repology.org/metapackage/python:gitpython/versions) -[![Throughput Graph](https://graphs.waffle.io/gitpython-developers/GitPython/throughput.svg)](https://waffle.io/gitpython-developers/GitPython/metrics/throughput) +This project is in **maintenance mode**, which means that -Now that there seems to be a massive user base, this should be motivation enough to let git-python -return to a proper state, which means +* …there will be no feature development, unless these are contributed +* …there will be no bug fixes, unless they are relevant to the safety of users, or contributed +* …issues will be responded to with waiting times of up to a month -* no open pull requests -* no open issues describing bugs +The project is open to contributions of all kinds, as well as new maintainers. [contributing]: https://github.com/gitpython-developers/GitPython/blob/master/CONTRIBUTING.md diff -Nru python-git-3.0.7/requirements.txt python-git-3.1.1/requirements.txt --- python-git-3.0.7/requirements.txt 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/requirements.txt 2020-02-24 11:39:24.000000000 +0000 @@ -1 +1 @@ -gitdb2>=2.0.0 +gitdb>=4.0.1,<5 diff -Nru python-git-3.0.7/setup.cfg python-git-3.1.1/setup.cfg --- python-git-3.0.7/setup.cfg 2020-02-08 03:29:30.000000000 +0000 +++ python-git-3.1.1/setup.cfg 2020-04-11 07:46:51.000000000 +0000 @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 0 - [egg_info] tag_build = tag_date = 0 diff -Nru python-git-3.0.7/setup.py python-git-3.1.1/setup.py --- python-git-3.0.7/setup.py 2020-02-08 02:56:18.000000000 +0000 +++ python-git-3.1.1/setup.py 2020-02-18 04:23:39.000000000 +0000 @@ -105,6 +105,7 @@ "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7" + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8" ] ) diff -Nru python-git-3.0.7/test-requirements.txt python-git-3.1.1/test-requirements.txt --- python-git-3.0.7/test-requirements.txt 2020-01-31 04:46:36.000000000 +0000 +++ python-git-3.1.1/test-requirements.txt 2020-02-23 23:31:24.000000000 +0000 @@ -1,5 +1,4 @@ ddt>=1.1.1 coverage flake8 -nose tox diff -Nru python-git-3.0.7/VERSION python-git-3.1.1/VERSION --- python-git-3.0.7/VERSION 2020-02-08 03:26:02.000000000 +0000 +++ python-git-3.1.1/VERSION 2020-04-11 07:40:31.000000000 +0000 @@ -1 +1 @@ -3.0.7 +3.1.1