Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2b6a72c

Browse files
authored
Merge pull request #440 from sliverc/use_tox_in_travis
Use tox to run test in travis
2 parents bea4743 + 0f01240 commit 2b6a72c

File tree

5 files changed

+44
-31
lines changed

5 files changed

+44
-31
lines changed

‎.gitignore‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ pip-delete-this-directory.txt
3030
.idea/
3131

3232
# PyTest cache
33-
.cache/
33+
.pytest_cache/
34+
35+
# Coverage
36+
.coverage
3437

3538
# Tox
3639
.tox/

‎.travis.yml‎

Lines changed: 19 additions & 27 deletions
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

‎setup.cfg‎

Lines changed: 11 additions & 1 deletion
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
@@ -18,3 +22,9 @@ known_standard_library = mock
1822
line_length = 100
1923
multi_line_output = 3
2024
skip_glob=*migrations*
25+
26+
[coverage:report]
27+
omit=
28+
.tox/*
29+
.eggs/*
30+
show_missing = True

‎setup.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ def get_package_data(package):
108108
'factory-boy',
109109
'pytest-django',
110110
'pytest',
111+
'pytest-cov',
111112
'django-polymorphic>=2.0',
112113
'packaging',
113114
'django-debug-toolbar'

‎tox.ini‎

Lines changed: 9 additions & 2 deletions
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

@@ -13,7 +15,12 @@ setenv =
1315
DJANGO_SETTINGS_MODULE=example.settings.test
1416

1517
commands =
16-
python setup.py test {posargs}
18+
python setup.py test --addopts '--cov --no-cov-on-fail' {posargs}
19+
20+
[testenv:flake8]
21+
deps = flake8
22+
commands = flake8
23+
skip_install = true
1724

1825
[testenv:isort]
1926
deps =
@@ -22,4 +29,4 @@ 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)

AltStyle によって変換されたページ (->オリジナル) /