[tox]
envlist =
  py27-{sqlite,postgres}
  py36-{sqlite,postgres}
  lint
  # pypy-{sqlite}
  # pypy3-{sqlite}
  # TODO: add pg8000


[testenv]
passenv = POSTGRES_URI

setenv =
  py{27,36}-postgres: SQLALCHEMY_DATABASE_URI = {env:POSTGRES_URI:postgres://localhost/abilian_core_test}

deps =
  setuptools>=36
  pip>=9.0.3
  -r{toxinidir}/requirements.txt
  -r{toxinidir}/etc/dev-requirements.txt

  # TODO: not for pypy
  psycopg2-binary

  # TODO for pypy: pip install -q pg8000


whitelist_externals =
  make
  npm
  sh

commands =
  sh -c 'echo ; echo SQLALCHEMY_DATABASE_URI = $SQLALCHEMY_DATABASE_URI ; echo'
  pip check
  npm install -q

  # Run tests
  py.test --tb=short \
    --junitxml={env:CIRCLE_TEST_REPORTS:.pytest}/pytest/junit.xml

[testenv:lint]
basepython = python3.6

deps =
  {[testenv]deps}
  # fix errors first
  # flake8-bugbear

commands =
  make lint-ci
