language: python

stages:
  - linting
  - test

cache:
  pip: true
  directories:
    - "$HOME/.cache/pypoetry"
    - "$HOME/.cache/pre-commit"

install:
  - pip install pip -U
  - pip install poetry --pre -U
  - poetry install -v

script: pytest -q tests/

jobs:
  include:
  - python: '2.7'
  - python: '3.5'
  - python: '3.6'
  - stage: linting
    python: '3.6'
    install:
    - pip install pre-commit
    - pre-commit install-hooks
    script:
    - pre-commit run --all-files
