Update tox and CI for Python 3

This commit is contained in:
Calum Lind 2018-10-08 16:05:40 +01:00
parent a980f8e959
commit 6fdbf0ba5d
4 changed files with 39 additions and 16 deletions

2
.gitignore vendored
View File

@ -17,4 +17,4 @@ deluge.pot
.build_data* .build_data*
osx/app osx/app
RELEASE-VERSION RELEASE-VERSION
.venv .venv*

View File

@ -17,6 +17,8 @@ addons:
packages: packages:
# Need Py 3.6 specifically for pre-commit to run black formatter. # Need Py 3.6 specifically for pre-commit to run black formatter.
- python3.6 - python3.6
# To provide ensurepip module.
- python3-venv
# command to install dependencies # command to install dependencies
install: install:
@ -32,19 +34,27 @@ install:
env: env:
global: global:
- APTPACKAGES="python-libtorrent" - APTPACKAGES="python-libtorrent python3-libtorrent"
- APTPACKAGES_GTKUI="python-glade2" - APTPACKAGES_GTKUI="python-glade2"
- DISPLAY=:99.0 - DISPLAY=:99.0
matrix: matrix:
include: include:
- env: TOX_ENV=pydef - name: Unit tests
env: TOX_ENV=pydef
- if: commit_message =~ SECURITY_TEST - if: commit_message =~ SECURITY_TEST
env: TOX_ENV=security env: TOX_ENV=security
- env: TOX_ENV=lint - name: Code linting
- env: TOX_ENV=docs env: TOX_ENV=lint
- env: TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI" - name: Docs build
- env: TOX_ENV=plugins env: TOX_ENV=docs
- name: PyGTK unit tests only
env: TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
- name: Plugins unit tests
env: TOX_ENV=plugins
- name: Python 3 unit tests
python: 3.5
env: TOX_ENV=py3
virtualenv: virtualenv:
system_site_packages: true system_site_packages: true
@ -52,7 +62,7 @@ virtualenv:
# We use xvfb for the GTKUI tests # 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" - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
- echo '2.0.0.dev0' > RELEASE-VERSION - echo '2.0.0.dev0' > RELEASE-VERSION

View File

@ -9,4 +9,4 @@ setproctitle
pywin32; sys.platform == 'win32' pywin32; sys.platform == 'win32'
py2-ipaddress; sys.platform == 'win32' py2-ipaddress; sys.platform == 'win32'
certifi; sys.platform == 'win32' certifi; sys.platform == 'win32'
zope-interface zope.interface

27
tox.ini
View File

@ -8,10 +8,14 @@ envlist = py27, lint, docs
minversion=2.0 minversion=2.0
[base] [base]
deps = -rrequirements.txt deps =
# Minimum pip version and setuptools to fix issue running on travis.
pip>=10
setuptools
-rrequirements.txt
[testenv] [testenv]
install_command = pip install --ignore-installed {opts} {packages} install_command = {envpython} -m pip install --ignore-installed {opts} {packages}
passenv = DISPLAY PYTHONPATH passenv = DISPLAY PYTHONPATH
setenv = PYTHONPATH = {toxinidir} setenv = PYTHONPATH = {toxinidir}
sitepackages = True sitepackages = True
@ -23,7 +27,7 @@ whitelist_externals = pytest
[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
# ========== # ==========
# Unit tests # Unit tests
@ -64,8 +68,6 @@ commands =
pytest -v --basetemp=_pytest_temp -s deluge/plugins pytest -v --basetemp=_pytest_temp -s deluge/plugins
[testenv:py27] [testenv:py27]
deps =
{[testenv]deps}
basepython = python2.7 basepython = python2.7
commands = {[testenv:pydef]commands} commands = {[testenv:pydef]commands}
@ -194,7 +196,18 @@ commands =
# ======================== # ========================
# Developement Environment # Developement Environment
# ======================== # ========================
[testenv:devenv] [basedev]
envdir = .venv
usedevelop = True usedevelop = True
deps = -rrequirements-dev.txt deps = -rrequirements-dev.txt
[testenv:denv2]
envdir = .venv2
basepython = python2.7
usedevelop = {[basedev]usedevelop}
deps = {[basedev]deps}
[testenv:denv3]
basepython = python3
envdir = .venv3
usedevelop = {[basedev]usedevelop}
deps = {[basedev]deps}