Cleanup Tox and CI configs

- Use the apt addon for installing libtorrent package.
- Start the py3 test sooner as it is slow to complete.
- Add if conditions for gtkui test dependencies.
- Remove Appveyor tests that are taken care of by Travis.
This commit is contained in:
Calum Lind 2018-10-10 14:49:39 +01:00
parent 6fdbf0ba5d
commit 0b2cb7539f
3 changed files with 57 additions and 77 deletions

View File

@ -3,69 +3,68 @@ sudo: required
language: python language: python
python: python:
- "2.7" - 2.7
cache: pip cache: pip
virtualenv:
before_install: system_site_packages: true
- lsb_release -a
- sudo add-apt-repository ppa:deluge-team/develop -yu
addons:
apt:
sources:
- deadsnakes
packages:
# Need Py 3.6 specifically for pre-commit to run black formatter.
- python3.6
# To provide ensurepip module.
- python3-venv
# command to install dependencies
install:
- bash -c "echo $APTPACKAGES"
- sudo apt install $APTPACKAGES
- pip install tox tox-venv
# the next part is for the security tests only.
- "if [ $TOX_ENV == 'security' ]; then
testssl_url=https://github.com/drwetter/testssl.sh/archive/v2.9.5-5.tar.gz;
wget -O- $testssl_url | tar xz
&& mv -t deluge/tests/data testssl.sh-2.9.5-5/testssl.sh testssl.sh-2.9.5-5/etc/;
fi"
env: env:
global: global:
- APTPACKAGES="python-libtorrent python3-libtorrent"
- APTPACKAGES_GTKUI="python-glade2"
- DISPLAY=:99.0 - DISPLAY=:99.0
matrix: matrix:
include: include:
- name: Unit tests - name: Unit tests - Python 2
env: TOX_ENV=pydef env: TOX_ENV=py27
- name: Unit tests - Python 3
python: 3.5
env: TOX_ENV=py3
- if: commit_message =~ SECURITY_TEST - if: commit_message =~ SECURITY_TEST
env: TOX_ENV=security env: TOX_ENV=security
- name: Code linting - name: Code linting
env: TOX_ENV=lint env: TOX_ENV=lint
- name: Docs build - name: Docs build
env: TOX_ENV=docs env: TOX_ENV=docs
- name: PyGTK unit tests only - name: PyGTK unit tests
env: TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI" env: TOX_ENV=pygtkui
- name: Plugins unit tests - name: Plugins unit tests
env: TOX_ENV=plugins env: TOX_ENV=plugins
- name: Python 3 unit tests
python: 3.5
env: TOX_ENV=py3
virtualenv: addons:
system_site_packages: true apt:
sources:
- sourceline: "ppa:deluge-team/develop"
- deadsnakes
packages:
- python-libtorrent
- python3-libtorrent
# Install py36 specifically for pre-commit to run black formatter.
- python3.6
# Intall python3-venv to provide ensurepip module for tox.
- python3-venv
# Install dependencies
install:
- pip install tox tox-venv
- "if [ $TOX_ENV == 'pygtkui' ]; then
sudo apt install python-glade2;
fi"
- "if [ $TOX_ENV == 'security' ]; then
testssl_url=https://github.com/drwetter/testssl.sh/archive/v2.9.5-5.tar.gz;
wget -O- $testssl_url | tar xz
&& mv -t deluge/tests/data testssl.sh-2.9.5-5/testssl.sh testssl.sh-2.9.5-5/etc/;
fi"
# We use xvfb for the GTKUI tests
before_script: before_script:
- export PYTHONPATH=$PYTHONPATH:$PWD - export PYTHONPATH=$PYTHONPATH:$PWD
- python -c "import libtorrent as lt; print(lt.__version__)" - python -c "import libtorrent as lt; print(lt.__version__)"
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16" # Start xvfb for the GTKUI tests
- echo '2.0.0.dev0' > RELEASE-VERSION - "if [ $TOX_ENV == 'pygtkui' ]; then
/sbin/start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile /tmp/custom_xvfb_99.pid \
--exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16;
fi"
- echo "2.0.0.dev0" > RELEASE-VERSION
script: script:
- bash -c "echo $DISPLAY"
- tox -e $TOX_ENV - tox -e $TOX_ENV

View File

@ -4,10 +4,8 @@ environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix: matrix:
- TOXENV: pydef - TOXENV: py27
- TOXENV: pygtkui - TOXENV: pygtkui
- TOXENV: plugins
- TOXENV: docs
- PYTHON_VERSION: "2.7.x" - PYTHON_VERSION: "2.7.x"
pull_requests: pull_requests:

47
tox.ini
View File

@ -4,7 +4,7 @@
# Usage: `pip install tox` and then run `tox` from this directory. # Usage: `pip install tox` and then run `tox` from this directory.
[tox] [tox]
envlist = py27, lint, docs envlist = py27, py3, lint, docs
minversion=2.0 minversion=2.0
[base] [base]
@ -22,58 +22,46 @@ sitepackages = True
deps = deps =
{[base]deps} {[base]deps}
-rrequirements-tests.txt -rrequirements-tests.txt
whitelist_externals = pytest commands =
python -c "import libtorrent as lt; print(lt.__version__)"
pytest -v -s -m "not (todo or gtkui or security)" deluge/tests
[pytest] [pytest]
# Hide logged warnings and errors in test output. # Hide logged warnings and errors in test output.
log_cli_level = CRITICAL log_cli_level = CRITICAL
addopts = -p no:warnings addopts = -p no:warnings --basetemp=_pytest_temp
# ========== # ==========
# Unit tests # Unit tests
# ========== # ==========
[testenv:pydef]
commands =
python -c "import libtorrent as lt; print(lt.__version__)"
pytest -v --basetemp=_pytest_temp -s -m "not (todo or gtkui or security)" deluge/tests
[testenv:security] [testenv:security]
setenv = SECURITY_TESTS = True setenv = SECURITY_TESTS = True
commands = pytest -v --basetemp=_pytest_temp -s -m "security" deluge/tests/ commands = pytest -v -s -m "security" deluge/tests/
[testenv:pygtkui] [testenv:pygtkui]
commands = pytest -v --basetemp=_pytest_temp -s -m "gtkui" deluge/tests commands = pytest -v -s -m "gtkui" deluge/tests
[testenv:todo] [testenv:todo]
commands = pytest -v --basetemp=_pytest_temp -s -m "todo" deluge/tests commands = pytest -v -s -m "todo" deluge/tests
[testenv:trial] [testenv:trial]
setenv = {[testenv]setenv}{:}{toxinidir}/deluge/tests setenv = {[testenv]setenv}{:}{toxinidir}/deluge/tests
commands = commands =
python -c "import libtorrent as lt; print lt.__version__" python -c "import libtorrent as lt; print(lt.__version__)"
python -m twisted.trial --reporter=deluge-reporter deluge.tests python -m twisted.trial --reporter=deluge-reporter deluge.tests
[testenv:plugins] [testenv:plugins]
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
whitelist_externals = bash
commands = commands =
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/ python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
pytest -v --basetemp=_pytest_temp -s -m "not gtkui" deluge/plugins pytest -v -s -m "not gtkui" deluge/plugins
[testenv:pluginsgtkui] [testenv:pluginsgtkui]
setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins setenv = PYTHONPATH = {toxinidir}{:}{toxinidir}/deluge/plugins
commands = commands =
python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/ python setup.py build_plugins --develop --install-dir={toxinidir}/deluge/plugins/
pytest -v --basetemp=_pytest_temp -s deluge/plugins pytest -v -s deluge/plugins
[testenv:py27]
basepython = python2.7
commands = {[testenv:pydef]commands}
[testenv:py3]
basepython = python3
commands = {[testenv:pydef]commands}
# ======================= # =======================
@ -134,15 +122,11 @@ deps =
{[testenv]deps} {[testenv]deps}
pytest-cov pytest-cov
coverage coverage
whitelist_externals =
{[testenv]whitelist_externals}
coverage
commands = coverage run --branch --source=deluge -m pytest -m "not todo" deluge/tests/ commands = coverage run --branch --source=deluge -m pytest -m "not todo" deluge/tests/
[testenv:testcoverage] [testenv:testcoverage]
setenv = {[testenv]setenv} setenv = {[testenv]setenv}
deps = {[testcoveragebase]deps} deps = {[testcoveragebase]deps}
whitelist_externals = {[testcoveragebase]whitelist_externals}
commands = commands =
{[testcoveragebase]commands} {[testcoveragebase]commands}
coverage report coverage report
@ -150,7 +134,6 @@ commands =
[testenv:testcoverage-html] [testenv:testcoverage-html]
setenv = {[testenv]setenv} setenv = {[testenv]setenv}
deps = {[testcoveragebase]deps} deps = {[testcoveragebase]deps}
whitelist_externals = {[testcoveragebase]whitelist_externals}
commands = commands =
{[testcoveragebase]commands} {[testcoveragebase]commands}
coverage html -d docs/build/htmlcoverage coverage html -d docs/build/htmlcoverage
@ -184,9 +167,7 @@ changedir = {[docsbase]changedir}
deps = deps =
{[docsbase]deps} {[docsbase]deps}
pytest-cov pytest-cov
whitelist_externals = whitelist_externals = mkdir
pytest
mkdir
commands = commands =
mkdir -p build/doccoverage mkdir -p build/doccoverage
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
@ -201,13 +182,15 @@ usedevelop = True
deps = -rrequirements-dev.txt deps = -rrequirements-dev.txt
[testenv:denv2] [testenv:denv2]
envdir = .venv2
basepython = python2.7 basepython = python2.7
envdir = .venv2
usedevelop = {[basedev]usedevelop} usedevelop = {[basedev]usedevelop}
deps = {[basedev]deps} deps = {[basedev]deps}
commands =
[testenv:denv3] [testenv:denv3]
basepython = python3 basepython = python3
envdir = .venv3 envdir = .venv3
usedevelop = {[basedev]usedevelop} usedevelop = {[basedev]usedevelop}
deps = {[basedev]deps} deps = {[basedev]deps}
commands =