summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-10-03 17:12:29 +0200
committerCalum Lind <calumlind@gmail.com>2018-10-05 14:23:45 +0200
commit6973f96f8cd5b51bccc094fef745803a4adcba99 (patch)
tree2ee02a14ad6b68fd3cea2aa715ba617ebc040c7d
parent[Lint] Add pre-commit config (diff)
downloaddeluge-6973f96f8cd5b51bccc094fef745803a4adcba99.tar.xz
deluge-6973f96f8cd5b51bccc094fef745803a4adcba99.zip
[Tests] Update tox and CI configs
- Add new requirements files to make it easier to install deps. - Tox changes - Update tox to use new requirements files. - Tweak heading styles. - Add development environment command `devenv`. - Remove testenv command as it would run on devenv creation. - Travis changes - Now uses xenial as trusty is very old now. - Trial run disabled to speed up tests. - Add tox-venv for Python 3 support. - Only install testssl if running security tests. - Appveyor - Add tox-venv for Python 3 support. - Use requirements file for non-tox. - Remove trial run to speed up testing.
-rw-r--r--.travis.yml21
-rw-r--r--appveyor.yml17
-rw-r--r--pyproject.toml1
-rw-r--r--requirements-dev.txt16
-rw-r--r--requirements-tests.txt10
-rw-r--r--requirements.txt12
-rw-r--r--tox.ini55
7 files changed, 82 insertions, 50 deletions
diff --git a/.travis.yml b/.travis.yml
index e049201d4..cd8fa102d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,4 @@
-dist: trusty
+dist: xenial
sudo: required
language: python
@@ -8,23 +8,24 @@ cache: pip
before_install:
- lsb_release -a
- - sudo add-apt-repository ppa:deluge-team/develop -y
- - sudo apt-get update
+ - sudo add-apt-repository ppa:deluge-team/develop -yu
# command to install dependencies
install:
- bash -c "echo $APTPACKAGES"
- - sudo apt-get install $APTPACKAGES
- - pip install tox
+ - sudo apt install $APTPACKAGES
+ - pip install tox tox-venv
# the next part is for the security tests only.
- - wget https://github.com/drwetter/testssl.sh/archive/v2.9.5-5.tar.gz -O testssl.tar.gz
- - tar -xvzf testssl.tar.gz
- - mv -t deluge/tests/data testssl.sh-2.9.5-5/testssl.sh testssl.sh-2.9.5-5/etc/
+ - "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:
global:
- APTPACKAGES="python-libtorrent"
- - APTPACKAGES_GTKUI="python-gobject python-glade2"
+ - APTPACKAGES_GTKUI="python-glade2"
- DISPLAY=:99.0
matrix:
@@ -36,7 +37,7 @@ matrix:
#- env: TOX_ENV=flake8-complexity
- env: TOX_ENV=docs
#- env: TOX_ENV=todo
- - env: TOX_ENV=trial APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
+ #- env: TOX_ENV=trial APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
- env: TOX_ENV=pygtkui APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
#- env: TOX_ENV=testcoverage APTPACKAGES="$APTPACKAGES $APTPACKAGES_GTKUI"
- env: TOX_ENV=plugins
diff --git a/appveyor.yml b/appveyor.yml
index 26a0edaec..ccc45d4dd 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,9 +4,7 @@ environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
matrix:
- # See: http://www.appveyor.com/docs/installed-software#python
- TOXENV: flake8
- - TOXENV: trial
- TOXENV: pydef
- TOXENV: pygtkui
- TOXENV: plugins
@@ -30,23 +28,12 @@ install:
- "python -m pip install --upgrade pip"
- if defined TOXENV (
- pip install
- tox
- pywin32
- certifi
+ pip install tox tox_venv
)
- if not defined TOXENV (
pip install
+ -rrequirements.txt
slimit
- twisted[tls]
- chardet
- mako
- pyxdg
- pillow
- slimit
- setproctitle
- pywin32
- certifi
pygame
bbfreeze
pefile
diff --git a/pyproject.toml b/pyproject.toml
index 8962ece64..b6dc2444b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -2,6 +2,7 @@
requires = [
"setuptools",
"wheel",
+ "slimit",
]
[tool.black]
diff --git a/requirements-dev.txt b/requirements-dev.txt
new file mode 100644
index 000000000..d03e06313
--- /dev/null
+++ b/requirements-dev.txt
@@ -0,0 +1,16 @@
+-r requirements.txt
+-r requirements-docs.txt
+-r requirements-tests.txt
+sphinx-autobuild
+tox
+tox-venv
+detox
+pre-commit
+pre-commit-hooks
+flake8-blind-except
+flake8-builtins
+flake8-commas
+flake8-comprehensions
+flake8-debugger
+flake8-mock
+flake8-mutable
diff --git a/requirements-tests.txt b/requirements-tests.txt
new file mode 100644
index 000000000..841b68fa4
--- /dev/null
+++ b/requirements-tests.txt
@@ -0,0 +1,10 @@
+pytest
+pytest-twisted
+pytest-cov
+mock
+flake8
+flake8-quotes
+flake8-isort
+pep8-naming
+mccabe
+pylint
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 000000000..fcc1b46d3
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,12 @@
+twisted[tls]>=16.6
+pyopenssl
+pyxdg
+pillow
+mako
+chardet
+six
+setproctitle
+pywin32; sys.platform == 'win32'
+py2-ipaddress; sys.platform == 'win32'
+certifi; sys.platform == 'win32'
+zope-interface
diff --git a/tox.ini b/tox.ini
index 936bb530d..fc008dfce 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,33 +7,28 @@
envlist = py27, flake8, docs
minversion=2.0
+[base]
+deps = -rrequirements.txt
+
[testenv]
install_command = pip install --ignore-installed {opts} {packages}
passenv = DISPLAY PYTHONPATH
setenv = PYTHONPATH = {toxinidir}
sitepackages = True
deps =
- twisted[tls]
- service_identity
- mako
- chardet
- pyopenssl
- pyxdg
- pytest
- pytest-twisted
- mock
+ {[base]deps}
+ -rrequirements-tests.txt
slimit
- pillow
-whitelist_externals = pytest bash
-commands = {envpython} setup.py test
+whitelist_externals = pytest
[pytest]
# Hide logged warnings and errors in test output.
log_cli_level = CRITICAL
-##############
+
+# ==========
# Unit tests
-##############
+# ==========
[testenv:pydef]
commands =
@@ -72,7 +67,6 @@ commands =
[testenv:py27]
deps =
{[testenv]deps}
- py2-ipaddress
basepython = python2.7
commands = {[testenv:pydef]commands}
@@ -80,12 +74,14 @@ commands = {[testenv:pydef]commands}
basepython = python3
commands = {[testenv:pydef]commands}
-###########################
-# Code style verification
-###########################
+
+# =======================
+# Code linting
+# =======================
[testenv:flake8]
-# Disable site packages to avoid using system flake8 which uses hardcoded python path which imports the wrong libraries.
+# Disable site packages to avoid using system flake8 which uses
+# hardcoded python path which imports the wrong libraries.
sitepackages = False
deps =
{[testenv]deps}
@@ -121,9 +117,9 @@ commands =
python -m pylint deluge/plugins/*/deluge/
-######################
-# Unit Test coverage
-######################
+# =============
+# Test coverage
+# =============
[testcoveragebase]
deps =
@@ -152,9 +148,9 @@ commands =
coverage html -d docs/build/htmlcoverage
-######################
-# Docs generation
-######################
+# ===================
+# Documentation build
+# ===================
# We do not have all dependencies on RTD and travis so we exclude the
# site packages (sitepackages=False) when building docs so that local
@@ -188,3 +184,12 @@ commands =
mkdir -p build/doccoverage
sphinx-build -W -b coverage -d build/doctrees source build/doccoverage
pytest --doctest-glob='*.rst'
+
+
+# ========================
+# Developement Environment
+# ========================
+[testenv:devenv]
+envdir = .venv
+usedevelop = True
+deps = -rrequirements-dev.txt