Skip to content

Commit fbd235b

Browse files
author
Oliver Sauder
committed
Use tox to run test in travis
This way we can harmonize tox and travis configuration
1 parent bea4743 commit fbd235b

File tree

4 files changed

+33
-30
lines changed

4 files changed

+33
-30
lines changed

Diff for: .gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pip-delete-this-directory.txt
3030
.idea/
3131

3232
# PyTest cache
33-
.cache/
33+
.pytest_cache/
3434

3535
# Tox
3636
.tox/

Diff for: .travis.yml

+19-27
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,42 @@
1-
---
21
language: python
32
sudo: false
43
cache: pip
54
# Favor explicit over implicit and use an explicit build matrix.
65
matrix:
76
include:
87
- python: 2.7
9-
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
8+
env: TOXENV=py27-django111-drf36
109
- python: 2.7
11-
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
10+
env: TOXENV=py27-django111-drf37
1211

1312
- python: 3.4
14-
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
13+
env: TOXENV=py34-django111-drf36
1514
- python: 3.4
16-
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
15+
env: TOXENV=py34-django111-drf37
1716
- python: 3.4
18-
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
17+
env: TOXENV=py34-django20-drf37
1918

2019
- python: 3.5
21-
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
20+
env: TOXENV=py35-django111-drf36
2221
- python: 3.5
23-
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
22+
env: TOXENV=py35-django111-drf37
2423
- python: 3.5
25-
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
24+
env: TOXENV=py35-django20-drf37
2625

2726
- python: 3.6
28-
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
27+
env: TOXENV=py36-django111-drf36
2928
- python: 3.6
30-
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
29+
env: TOXENV=py36-django111-drf37
3130
- python: 3.6
32-
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
33-
before_install:
34-
# Force an upgrade of py & pytest to avoid VersionConflict
35-
- pip install --upgrade py
36-
# Faker requires a newer pytest
37-
- pip install "pytest>3.3"
38-
- pip install codecov flake8 isort
31+
env: TOXENV=py36-django20-drf37
32+
- python: 3.6
33+
env: TOXENV=flake8
34+
- python: 3.6
35+
env: TOXENV=isort
3936
install:
40-
- pip install Django${DJANGO} djangorestframework${DRF}
41-
- python setup.py install
37+
- pip install tox
4238
script:
43-
- flake8
44-
- isort --check-only --verbose --recursive --diff rest_framework_json_api
45-
# example has extra dependencies that are installed in a dev environment
46-
# but are not installed in CI. Explicitly set those packages.
47-
- isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy --thirdparty packaging example
48-
- coverage run setup.py -v test
39+
- tox
4940
after_success:
50-
- codecov
41+
- pip install codecov
42+
- codecov -e TOXENV

Diff for: setup.cfg

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ universal = 1
77
[flake8]
88
ignore = F405
99
max-line-length = 100
10-
exclude = docs/conf.py,build,migrations
10+
exclude =
11+
docs/conf.py,
12+
build,
13+
migrations,
14+
.tox,
1115

1216
[isort]
1317
indent = 4

Diff for: tox.ini

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
[tox]
22
envlist =
33
py{27,34,35,36}-django111-drf{36,37},
4+
py{34,35,36}-django20-drf{37},
45

56
[testenv]
67
deps =
78
django111: Django>=1.11,<1.12
9+
django20: Django>=2.0,<2.1
810
drf36: djangorestframework>=3.6.3,<3.7
911
drf37: djangorestframework>=3.7.0,<3.8
1012

@@ -15,11 +17,16 @@ setenv =
1517
commands =
1618
python setup.py test {posargs}
1719

20+
[testenv:flake8]
21+
deps = flake8
22+
commands = flake8
23+
skip_install = true
24+
1825
[testenv:isort]
1926
deps =
2027
isort
2128
commands =
2229
isort --check-only --verbose --recursive --diff rest_framework_json_api
2330
# example has extra dependencies that are installed in a dev environment
2431
# but are not installed in CI. Explicitly set those packages.
25-
isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy example
32+
isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy --thirdparty packaging example

0 commit comments

Comments
 (0)