Skip to content

Commit 5efc2fb

Browse files
committed
use tox.ini, closes #238
1 parent a34cac8 commit 5efc2fb

8 files changed

+121
-50
lines changed

.flake8

Lines changed: 0 additions & 5 deletions
This file was deleted.

.isort.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,15 @@ repos:
1818
hooks:
1919
- id: pyupgrade
2020
args: ['--py36-plus']
21-
- repo: https://github.com/pre-commit/mirrors-isort
22-
rev: v4.3.21
23-
hooks:
24-
- id: isort
25-
args:
26-
- --multi-line=3
27-
- --trailing-comma
28-
- --force-grid-wrap=0
29-
- --use-parentheses
30-
- --line-width=88
3121
- repo: https://github.com/asottile/seed-isort-config
3222
rev: v1.9.3
3323
hooks:
3424
- id: seed-isort-config
25+
- repo: https://github.com/pre-commit/mirrors-isort
26+
rev: v4.3.21
27+
hooks:
28+
- id: isort
3529
- repo: https://gitlab.com/pycqa/flake8
3630
rev: 3.7.9
3731
hooks:
3832
- id: flake8
39-
args:
40-
- --max-line-length=500
41-
- --ignore=E203,E266,E501,W503
42-
- --max-complexity=18
43-
- --select=B,C,E,F,W,T4,B9

azure-pipelines.yml

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,43 @@
1+
trigger:
2+
branches:
3+
include:
4+
- master
5+
pr:
6+
- "*"
7+
18
jobs:
2-
- job: unit_tests
9+
- job: pytest
310
steps:
4-
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
5-
displayName: Add conda to PATH
6-
7-
- script: conda env create --quiet --file environment.yml
8-
displayName: Create Anaconda environment
9-
10-
- script: |
11-
source activate adaptive
12-
pip install -r test-requirements.txt
13-
displayName: 'Install test-requirements.txt'
14-
11+
- task: UsePythonVersion@0
12+
inputs:
13+
versionSpec: '3.7'
1514
- script: |
16-
source activate adaptive
17-
pytest --verbose --cov=adaptive --cov-report term --cov-report html adaptive
15+
pip install tox
16+
tox -e py36,py37
1817
displayName: 'Run the tests'
1918
20-
- job: linting_tests
19+
- job: pre_commit
2120
steps:
22-
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
23-
displayName: Add conda to PATH
21+
- task: UsePythonVersion@0
22+
inputs:
23+
versionSpec: '3.7'
24+
- script: |
25+
pip install tox
26+
tox -e pre-commit
27+
displayName: 'Lining tests'
2428
29+
- job: coverage
30+
steps:
31+
- task: UsePythonVersion@0
32+
inputs:
33+
versionSpec: '3.7'
2534
- script: |
26-
pip install pre_commit
27-
pre-commit install
28-
pre-commit run --all-files --show-diff-on-failure
29-
displayName: 'Run pre-commit'
35+
pip install tox
36+
tox -e clean,report
37+
displayName: 'Test coverage'
3038
39+
- job: authors_check
40+
steps:
3141
- script: |
3242
MISSING_AUTHORS=$(git shortlog -s HEAD | sed -e "s/^[0-9\t ]*//"| xargs -i sh -c 'grep -q "{}" AUTHORS.md || echo "{} missing from authors"')
3343
if [ ! -z "$MISSING_AUTHORS" ]; then { echo $MISSING_AUTHORS; exit 1; }; fi

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 35.0.2",
4+
"setuptools_scm >= 2.0.0, <3"
5+
]
6+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ def get_version_and_cmdclass(package_name):
4040
"bokeh",
4141
"matplotlib",
4242
"plotly",
43-
]
43+
],
44+
"testing": [
45+
"pexpect",
46+
"pytest",
47+
"pytest-cov",
48+
"pytest-randomly",
49+
"pytest-timeout",
50+
"pre_commit",
51+
],
52+
"other": ["ipyparallel", "distributed", "scikit-optimize"],
4453
}
4554

4655

test-requirements.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

tox.ini

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
2+
[tox]
3+
isolated_build = True
4+
envlist = clean,py{36,37},report,pre-commit
5+
6+
[pytest]
7+
addopts =
8+
--durations=5
9+
--cov --cov-append --cov-fail-under=100 --cov-report=
10+
norecursedirs =
11+
docs
12+
13+
[coverage:paths]
14+
source =
15+
adaptive
16+
.tox/py*/lib/python*/site-packages
17+
18+
[coverage:run]
19+
branch = true
20+
parallel = true
21+
source = adaptive
22+
23+
[coverage:report]
24+
show_missing = true
25+
precision = 2
26+
27+
[coverage:xml]
28+
output = .coverage.xml
29+
30+
[testenv]
31+
deps = .[test]
32+
commands =
33+
pip install -e .[testing,other]
34+
pytest
35+
depends =
36+
{py36,py37}: clean
37+
report: {py36,py37}
38+
39+
[testenv:report]
40+
deps = coverage
41+
skip_install = true
42+
commands =
43+
pip install -e .[testing,other]
44+
coverage report
45+
coverage xml
46+
47+
[testenv:clean]
48+
deps = coverage
49+
skip_install = true
50+
commands = coverage erase
51+
52+
[testenv:pre-commit]
53+
skip_install = true
54+
deps = pre-commit
55+
commands = pre-commit run --all-files --show-diff-on-failure
56+
57+
[flake8]
58+
max-line-length = 100
59+
ignore = E501, W503, E203, E266
60+
max-complexity = 18
61+
select = B, C, E, F, W, T4, B9
62+
exclude = .git, .tox, __pycache__, dist
63+
64+
[isort]
65+
multi-line=3
66+
trailing-comma=true
67+
force-grid-wrap=0
68+
use-parentheses=true
69+
line-width=88
70+
known_third_party=PIL,atomicwrites,holoviews,ipykernel,matplotlib,nbconvert,numpy,pytest,scipy,setuptools,skopt,sortedcollections,sortedcontainers,zmq

0 commit comments

Comments
 (0)