test pull requests under Python 3 as well

This commit is contained in:
Mike Bonnet
2019-02-05 10:45:33 -08:00
committed by mprahl
parent b4d3c51219
commit 0b3d7809f9
5 changed files with 80 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ RUN yum -y install \
rpm-build \
&& yum clean all
# We currently require a newer versions of these Python packages for the tests
RUN pip install --upgrade flask-sqlalchemy pytest flake8 tox
RUN pip install --upgrade flask-sqlalchemy pytest flake8 tox pip
VOLUME /src
WORKDIR /src
CMD ["bash", "docker/test.sh"]

View File

@@ -0,0 +1,38 @@
FROM fedora:29
WORKDIR /build
RUN dnf -y install \
--nogpgcheck \
--setopt=deltarpm=0 \
--setopt=install_weak_deps=false \
--setopt=tsflags=nodocs \
git-core \
createrepo_c \
python3-fedmsg \
python3-kobo-rpmlib \
python3-rpm \
libmodulemd \
python3-gobject \
python3-dogpile-cache \
python3-flask \
python3-flask-migrate \
python3-flask-sqlalchemy \
python3-koji \
python3-ldap3 \
python3-munch \
python3-pip \
python3-requests \
python3-six \
python3-solv \
python3-sqlalchemy \
python3-pungi \
# Test-only dependencies
python3-pytest \
python3-flake8 \
python3-mock \
python3-tox \
rpm-build \
&& dnf clean all
VOLUME /src
WORKDIR /src
CMD ["bash", "docker/test-py3.sh"]

34
docker/test-py3.sh Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# Remove requirements not necessary for Python 3.7.
# Also, prevent koji from being re-installed from PyPi.
cp requirements.txt requirements.txt.orig.py3
sed -i \
-e '/enum34/d' \
-e '/funcsigs/d' \
-e '/futures/d' \
-e '/koji/d' \
requirements.txt
# Run everything with Python 3
cp tox.ini tox.ini.orig.py3
sed -i \
-e 's/py.test/py.test-3/g' \
-e '/basepython/d' \
tox.ini
# Delete any leftover compiled Python files
for dir in module_build_service tests; do
find ${dir} -type f \( -name '*.pyc' -or -name '*.pyc' \) -exec rm -f {} \;
done
# Since tox seems to ignore `usedevelop` when we have `sitepackages` on, we have to run it manually
python3 setup.py develop --no-deps
/usr/bin/tox -e flake8,py3
rv=$?
# After running tox, we can revert back to the original files
rm -f requirements.txt tox.ini
mv requirements.txt.orig.py3 requirements.txt
mv tox.ini.orig.py3 tox.ini
exit $rv

View File

@@ -8,6 +8,9 @@ sed -i '/koji/d' requirements.txt
for dir in module_build_service tests; do
find ${dir} -type f \( -name '*.pyc' -or -name '*.pyc' \) -exec rm -f {} \;
done
# The python-virtualenv package bundles a very old version of pip,
# which is incompatible with modern virtualenv.
rm -f /usr/lib/python2.7/site-packages/virtualenv_support/pip-9*
# Since tox seems to ignore `usedevelop` when we have `sitepackages` on, we have to run it manually
python setup.py develop --no-deps
/usr/bin/tox -e flake8,py27