Skip to content

Commit 3cb73b3

Browse files
committed
Testing use of tox to simplify
travis configuration. adding the existing flake8 tests that were existing in travis (but these are quite similar I think) allowing pre-commit to fail for now
1 parent b5da887 commit 3cb73b3

File tree

3 files changed

+62
-22
lines changed

3 files changed

+62
-22
lines changed

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ repos:
88
rev: 19.10b0
99
hooks:
1010
- id: black
11-
args: ['--line-length', '140']
11+
args: ['--line-length', '127']
1212
- repo: https://gitlab.com/pycqa/flake8
1313
rev: 3.8.2
1414
hooks:
1515
- id: flake8
16-
args: ['--max-line-length=140', '--ignore=W191,W201,W291,W293,W391,W503,W605,E101,E203,E262,E265,E266,E302,E402,E501,E711,E712,E713,E714,E721,E741,F401,F403,F405,F811,F841']
16+
args: ['--max-line-length=127', '--ignore=W191,W201,W291,W293,W391,W503,W605,E101,E203,E262,E265,E266,E302,E402,E501,E711,E712,E713,E714,E721,E741,F401,F403,F405,F811,F841']

.travis.yml

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
language: python
22
cache: pip
3-
python:
4-
- "2.7"
5-
- "3.5"
6-
- "3.6"
7-
- "3.7"
3+
matrix:
4+
include:
5+
- python: 2.7
6+
env: TOXENV=py27
7+
- python: 3.5
8+
env: TOXENV=py35
9+
- python: 3.6
10+
env: TOXENV=py36
11+
- python: 3.7
12+
env: TOXENV=py37
13+
- python: 3.8
14+
env: TOXENV=py38
15+
- python: 3.7
16+
env: TOXENV=precommit
17+
- python: 3.7
18+
env: TOXENV=flake8
19+
allow_failures:
20+
env: TOXENV=precommit
821
addons:
922
chrome: stable
1023
firefox: latest
1124
env:
1225
global:
1326
- MOZ_HEADLESS=1
1427
install:
15-
# install dependencies from setup.py (there are none for remi)
16-
- pip install -e .
17-
# install optional packages (for linting, coverage, browser control)
18-
# and dependencies of example apps being tested
19-
- pip install flake8 coverage matplotlib Pillow selenium
28+
- pip install tox
2029
# install specific webdrivers for selenium
2130
- ./test/install_webdrivers
2231
- export PATH="$HOME/.local/bin:$PATH"
23-
before_script:
24-
# stop the build if there are Python syntax errors or undefined names
25-
- flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
26-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
27-
- flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2832
script:
29-
# this "coverage" command is equivalent to running `python test/`
30-
- coverage run test/
31-
after_script:
32-
- coverage report --include="examples/*,test/*"
33-
- coverage report --include="remi/*,editor/*"
33+
- tox

tox.ini

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[tox]
2+
project = remi
3+
# this should match the travis env list
4+
envlist = py27,py35,py36,py37,precommit,flake8
5+
6+
##
7+
# Default tests (unit tests)
8+
##
9+
[testenv]
10+
deps =
11+
coverage
12+
matplotlib
13+
Pillow
14+
selenium
15+
whitelist_externals =
16+
chromedriver
17+
commands =
18+
python -m coverage erase
19+
python -m coverage run test/
20+
python -m coverage report --include="examples/*,test/*"
21+
python -m coverage report --include="{toxinidir}/*remi/*,*editor/*"
22+
23+
##
24+
# Syntax tests
25+
##
26+
[testenv:precommit]
27+
description = Run flake8, black and friends
28+
deps =
29+
pre-commit
30+
commands =
31+
pre-commit install -f --install-hooks
32+
pre-commit run --all-files
33+
34+
[testenv:flake8]
35+
description = Run essential flake8 test
36+
deps =
37+
flake8
38+
commands =
39+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
40+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

0 commit comments

Comments
 (0)