Fix setup.py and use of requirements files and add a docker test container by jeking3 · Pull Request #826 · gitpython-developers/GitPython (original) (raw)

Before:

jking@ubuntu:~/GitPython$ python3 setup.py check
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_requirements'
  warnings.warn(msg)
running check

Note that setup.py was not even using the contents of requirements.txt or test-requirements.txt. Now it does, and it properly identifies the tests-require field. The requirements.txt file declared a runtime dependency on a testing package. I'm assuming that is an error (although it could be used in production code, I don't know...) so I removed that.

When I ran tox locally on Python 3.6.7 I saw a flake8 error F821 which I disabled as it looks bogus - that exception is defined in the documentation.

Added a docker container that you can use with a couple new make targets. This allows you to run python 2.7, 3.4, 3.5, 3.6, or 3.7 tox even if you are on a local branch not named "master" (some tests require this).

Finally, found and fixed the issue on CI with python 3.7 / Xenial / travis. The root cause is that in git 2.20 new behavior was introduced to stop "git fetch --tags" from clobbering local tags that have changed: git/git@0bc8d71

The unit tests expect the old behavior, so now we pass --force down if the version is 2.20 or higher (for the remote test only, the code change is in the test code). It took a while to find this because for some reason when GitCommandError returns an error code, stderr isn't captured. If it was, it would have been easier to figure this out...