Skip to content

Use tox to run test in travis #440

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pip-delete-this-directory.txt
.idea/

# PyTest cache
.cache/
.pytest_cache/

# Tox
.tox/
Expand Down
46 changes: 19 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,42 @@
---
language: python
sudo: false
cache: pip
# Favor explicit over implicit and use an explicit build matrix.
matrix:
include:
- python: 2.7
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
env: TOXENV=py27-django111-drf36
- python: 2.7
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
env: TOXENV=py27-django111-drf37

- python: 3.4
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
env: TOXENV=py34-django111-drf36
- python: 3.4
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
env: TOXENV=py34-django111-drf37
- python: 3.4
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
env: TOXENV=py34-django20-drf37

- python: 3.5
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
env: TOXENV=py35-django111-drf36
- python: 3.5
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
env: TOXENV=py35-django111-drf37
- python: 3.5
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
env: TOXENV=py35-django20-drf37

- python: 3.6
env: DJANGO=">=1.11,<2.0" DRF=">=3.6.3,<3.7"
env: TOXENV=py36-django111-drf36
- python: 3.6
env: DJANGO=">=1.11,<2.0" DRF=">=3.7.0,<3.8"
env: TOXENV=py36-django111-drf37
- python: 3.6
env: DJANGO=">=2.0,<2.1" DRF=">=3.7.0,<3.8"
before_install:
# Force an upgrade of py & pytest to avoid VersionConflict
- pip install --upgrade py
# Faker requires a newer pytest
- pip install "pytest>3.3"
- pip install codecov flake8 isort
env: TOXENV=py36-django20-drf37
- python: 3.6
env: TOXENV=flake8
- python: 3.6
env: TOXENV=isort
install:
- pip install Django${DJANGO} djangorestframework${DRF}
- python setup.py install
- pip install tox
script:
- flake8
- isort --check-only --verbose --recursive --diff rest_framework_json_api
# example has extra dependencies that are installed in a dev environment
# but are not installed in CI. Explicitly set those packages.
- isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy --thirdparty packaging example
- coverage run setup.py -v test
- tox
after_success:
- codecov
- pip install codecov
- codecov -e TOXENV
6 changes: 5 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ universal = 1
[flake8]
ignore = F405
max-line-length = 100
exclude = docs/conf.py,build,migrations
exclude =
docs/conf.py,
build,
migrations,
.tox,

[isort]
indent = 4
Expand Down
9 changes: 8 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[tox]
envlist =
py{27,34,35,36}-django111-drf{36,37},
py{34,35,36}-django20-drf{37},

[testenv]
deps =
django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
drf36: djangorestframework>=3.6.3,<3.7
drf37: djangorestframework>=3.7.0,<3.8

Expand All @@ -15,11 +17,16 @@ setenv =
commands =
python setup.py test {posargs}

[testenv:flake8]
deps = flake8
commands = flake8
skip_install = true

[testenv:isort]
deps =
isort
commands =
isort --check-only --verbose --recursive --diff rest_framework_json_api
# example has extra dependencies that are installed in a dev environment
# but are not installed in CI. Explicitly set those packages.
isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy example
isort --check-only --verbose --recursive --diff --thirdparty pytest --thirdparty polymorphic --thirdparty pytest_factoryboy --thirdparty packaging example