summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames E. King III <jking@apache.org>2019-02-05 13:40:12 -0500
committerSebastian Thiel <byronimo@gmail.com>2019-05-05 13:22:53 +0530
commit52ee33ac9b234c7501d97b4c2bf2e2035c5ec1fa (patch)
tree284d5f9db4f88e8d4e9c3ce7aa52d22714e73ff8
parent14b221bf98757ba61977c1021722eb2faec1d7cc (diff)
downloadgitpython-52ee33ac9b234c7501d97b4c2bf2e2035c5ec1fa.tar.gz
Added a Dockerfile that creates a clean Ubuntu Xenial test environment
-rw-r--r--.appveyor.yml13
-rw-r--r--.dockerignore2
-rw-r--r--.travis.yml3
-rw-r--r--Dockerfile80
-rw-r--r--Makefile16
-rwxr-xr-xdockernose.sh8
-rw-r--r--git/cmd.py7
-rw-r--r--git/remote.py2
-rw-r--r--test-requirements.txt1
9 files changed, 122 insertions, 10 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 2df96e42..017cf120 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -5,8 +5,6 @@ environment:
CYGWIN64_GIT_PATH: "C:\\cygwin64\\bin;%GIT_DAEMON_PATH%"
matrix:
- ## MINGW
- #
- PYTHON: "C:\\Python27"
PYTHON_VERSION: "2.7"
GIT_PATH: "%GIT_DAEMON_PATH%"
@@ -25,21 +23,24 @@ environment:
- PYTHON: "C:\\Miniconda35-x64"
PYTHON_VERSION: "3.5"
IS_CONDA: "yes"
+ MAYFAIL: "yes"
GIT_PATH: "%GIT_DAEMON_PATH%"
-
## Cygwin
- #
- PYTHON: "C:\\Miniconda-x64"
PYTHON_VERSION: "2.7"
IS_CONDA: "yes"
IS_CYGWIN: "yes"
+ MAYFAIL: "yes"
GIT_PATH: "%CYGWIN_GIT_PATH%"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5"
- GIT_PATH: "%CYGWIN64_GIT_PATH%"
IS_CYGWIN: "yes"
+ MAYFAIL: "yes"
+ GIT_PATH: "%CYGWIN64_GIT_PATH%"
-
+matrix:
+ allow_failures:
+ - MAYFAIL: "yes"
install:
- set PATH=%PYTHON%;%PYTHON%\Scripts;%GIT_PATH%;%PATH%
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..b59962d2
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.git/
+.tox/
diff --git a/.travis.yml b/.travis.yml
index c0c38a34..aed714af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -9,12 +9,11 @@ matrix:
include:
- python: 3.7
dist: xenial
- sudo: required
- python: "nightly"
dist: xenial
- sudo: required
allow_failures:
- python: "nightly"
+ dist: xenial
git:
# a higher depth is needed for most of the tests - must be high enough to not actually be shallow
# as we clone our own repository in the process
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 00000000..fc42f18f
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,80 @@
+#
+# Contributed by: James E. King III (@jeking3) <jking@apache.org>
+#
+# This Dockerfile creates an Ubuntu Xenial build environment
+# that can run the same test suite as Travis CI.
+#
+
+FROM ubuntu:xenial
+MAINTAINER James E. King III <jking@apache.org>
+ENV CONTAINER_USER=user
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get update && \
+ apt-get install -y --no-install-recommends \
+ add-apt-key \
+ apt \
+ apt-transport-https \
+ apt-utils \
+ ca-certificates \
+ curl \
+ git \
+ net-tools \
+ openssh-client \
+ sudo \
+ vim \
+ wget
+
+RUN add-apt-key -v 6A755776 -k keyserver.ubuntu.com && \
+ add-apt-key -v E1DF1F24 -k keyserver.ubuntu.com && \
+ echo "deb http://ppa.launchpad.net/git-core/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
+ echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" >> /etc/apt/sources.list && \
+ apt-get update && \
+ apt-get install -y --install-recommends git python2.7 python3.4 python3.5 python3.6 python3.7 && \
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python2.7 27 && \
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.4 34 && \
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 35 && \
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 36 && \
+ update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 37
+
+RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
+ python3 get-pip.py && \
+ pip3 install tox
+
+# Clean up
+RUN rm -rf /var/cache/apt/* && \
+ rm -rf /var/lib/apt/lists/* && \
+ rm -rf /tmp/* && \
+ rm -rf /var/tmp/*
+
+#################################################################
+# Build as a regular user
+# Credit: https://github.com/delcypher/docker-ubuntu-cxx-dev/blob/master/Dockerfile
+# License: None specified at time of import
+# Add non-root user for container but give it sudo access.
+# Password is the same as the username
+RUN useradd -m ${CONTAINER_USER} && \
+ echo ${CONTAINER_USER}:${CONTAINER_USER} | chpasswd && \
+ echo "${CONTAINER_USER} ALL=(root) ALL" >> /etc/sudoers
+RUN chsh --shell /bin/bash ${CONTAINER_USER}
+USER ${CONTAINER_USER}
+#################################################################
+
+# The test suite will not tolerate running against a branch that isn't "master", so
+# check out the project to a well-known location that can be used by the test suite.
+# This has the added benefit of protecting the local repo fed into the container
+# as a volume from getting destroyed by a bug exposed by the test suite. :)
+ENV TRAVIS=ON
+RUN git clone --recursive https://github.com/gitpython-developers/GitPython.git /home/${CONTAINER_USER}/testrepo && \
+ cd /home/${CONTAINER_USER}/testrepo && \
+ ./init-tests-after-clone.sh
+ENV GIT_PYTHON_TEST_GIT_REPO_BASE=/home/${CONTAINER_USER}/testrepo
+ENV TRAVIS=
+
+# Ensure any local pip installations get on the path
+ENV PATH=/home/${CONTAINER_USER}/.local/bin:${PATH}
+
+# Set the global default git user to be someone non-descript
+RUN git config --global user.email ci@gitpython.org && \
+ git config --global user.name "GitPython CI User"
+
diff --git a/Makefile b/Makefile
index 764b822b..ae74a0d8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+.PHONY: all clean release force_release docker-build test nose-pdb
+
all:
@grep -Ee '^[a-z].*:' Makefile | cut -d: -f1 | grep -vF all
@@ -16,3 +18,17 @@ force_release: clean
git push --tags origin master
python3 setup.py sdist bdist_wheel
twine upload -s -i byronimo@gmail.com dist/*
+
+docker-build:
+ docker build --quiet -t gitpython:xenial -f Dockerfile .
+
+test: docker-build
+ # NOTE!!!
+ # NOTE!!! If you are not running from master or have local changes then tests will fail
+ # NOTE!!!
+ docker run --rm -v ${CURDIR}:/src -w /src -t gitpython:xenial tox
+
+nose-pdb: docker-build
+ # run tests under nose and break on error or failure into python debugger
+ # HINT: set PYVER to "pyXX" to change from the default of py37 to pyXX for nose tests
+ docker run --rm --env PYVER=${PYVER} -v ${CURDIR}:/src -w /src -it gitpython:xenial /bin/bash dockernose.sh
diff --git a/dockernose.sh b/dockernose.sh
new file mode 100755
index 00000000..0f741967
--- /dev/null
+++ b/dockernose.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env bash
+set -ex
+if [ -z "${PYVER}" ]; then
+ PYVER=py37
+fi
+
+tox -e ${PYVER} --notest
+PYTHONPATH=/src/.tox/${PYVER}/lib/python*/site-packages /src/.tox/${PYVER}/bin/nosetests --pdb $*
diff --git a/git/cmd.py b/git/cmd.py
index e442095e..64c3d480 100644
--- a/git/cmd.py
+++ b/git/cmd.py
@@ -715,8 +715,11 @@ class Git(LazyMixin):
stdout_sink = (PIPE
if with_stdout
else getattr(subprocess, 'DEVNULL', None) or open(os.devnull, 'wb'))
- log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s)",
- command, cwd, universal_newlines, shell)
+ istream_ok = "None"
+ if istream:
+ istream_ok = "<valid stream>"
+ log.debug("Popen(%s, cwd=%s, universal_newlines=%s, shell=%s, istream=%s)",
+ command, cwd, universal_newlines, shell, istream_ok)
try:
proc = Popen(command,
env=env,
diff --git a/git/remote.py b/git/remote.py
index 8aec68e1..0965c1f6 100644
--- a/git/remote.py
+++ b/git/remote.py
@@ -695,6 +695,8 @@ class Remote(LazyMixin, Iterable):
msg += "Will ignore extra progress lines or fetch head lines."
msg %= (l_fil, l_fhi)
log.debug(msg)
+ log.debug("info lines: " + str(fetch_info_lines))
+ log.debug("head info : " + str(fetch_head_info))
if l_fil < l_fhi:
fetch_head_info = fetch_head_info[:l_fil]
else:
diff --git a/test-requirements.txt b/test-requirements.txt
index 084925a1..ec0e4c56 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -2,4 +2,5 @@ ddt>=1.1.1
coverage
flake8
nose
+tox
mock; python_version=='2.7'