tox.ini 1.5 KB
Newer Older
1
[tox]
2
envlist = check,py34,datasets
3

4
# default test set runs test suite and fixture integrity checks
Johan Bloemberg's avatar
Johan Bloemberg committed
5
[testenv]
Johan Bloemberg's avatar
Johan Bloemberg committed
6
basepython = python3
Johan Bloemberg's avatar
Johan Bloemberg committed
7
usedevelop = True
8 9 10 11
extras =
  development
  # allow extras (eg: deploy requirements) to be enabled in CI
  {env:TOX_EXTRAS:}
Johan Bloemberg's avatar
Johan Bloemberg committed
12 13 14

setenv =
  DJANGO_SETTINGS_MODULE = failmap_admin.settings
15 16
  # set database or fallback on sqlite memory database
  DJANGO_DATABASE = {env:DJANGO_DATABASE:test}
17 18 19
passenv =
  DB_HOST
  DB_ENGINE
Johan Bloemberg's avatar
Johan Bloemberg committed
20

Johan Bloemberg's avatar
Johan Bloemberg committed
21
commands =
22
  # run testsuite
23
  coverage run --include 'failmap_admin/*' -m pytest {posargs}
24
  # generate coverage
Johan Bloemberg's avatar
Johan Bloemberg committed
25
  coverage report
26

27 28 29 30
# run code quality check
[testenv:check]
commands =
  # make sure code quality is up to par
31
  pylama failmap_admin tests setup.py
32

33
# ensure all datasets can be imported (and indirectly if all migrations work)
Johan Bloemberg's avatar
Johan Bloemberg committed
34
[testenv:datasets]
35
commands =
36
    # find all fixtures in source and verify loading each one
Johan Bloemberg's avatar
Johan Bloemberg committed
37
    /bin/sh -ec "find failmap_admin -path '*/fixtures/*.yaml' -print0 | \
38
        xargs -0n1 basename -s .yaml | uniq | \
39
        xargs -n1 failmap-admin test-dataset"
Johan Bloemberg's avatar
Johan Bloemberg committed
40

41
# utility to perform autofixing of trivial code quality issues
42
[testenv:autofix]
Johan Bloemberg's avatar
Johan Bloemberg committed
43
# install all dependencies so isort knows packages belong where
44
commands =
45
  # fix trivial pep8 style issues
46
  autopep8 -ri failmap_admin tests setup.py
47 48 49
  # remove unused imports
  autoflake -ri --remove-all-unused-imports failmap_admin tests setup.py
  # sort imports
50
  isort -rc failmap_admin tests setup.py
51 52 53
  # do a check after autofixing to show remaining problems
  pylama failmap_admin tests