language: python
python:
  - "2.7"
  - "3.6"

services:
  - mongodb

# for plugins that require UI
before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3

install:
  - if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then pip install --upgrade pytest; else pip uninstall -y pytest; fi
  - pip install -r requirements.txt
env:
  matrix:
  - PYTEST_VERSION=3.7.3 PLUGINCOMPAT_SITE=http://plugincompat.herokuapp.com
  global:
    secure: "GYMlRL/xmnVjC2+RljsZj0aVNIOv/d7x36UBT5DNo+FlY4jGHin9nb3tckKzwh+VgNexcZ6O4UY6CRHZdTuwME1LlI4Mywx44y48oomA6lz1RMZI6OP9CF3SbcEl/Qs++sS/USEQNGB9IdWnF11dqbJ7XOI2E9CZk4bX9ZLQVdA="
script:
  - if [ "$TRAVIS_EVENT_TYPE" = "pull_request" ]; then pytest; else python run.py; fi

branches:
  only:
    - master
    - /feature-.*/

language: python
services:
  - mongodb

# for plugins that require UI
before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3

install:
  - pip install -r requirements.txt -U pytest

jobs:
  include:
    - env: RUN_COMMAND=python run.py
      python: '2.7'
    - env: RUN_COMMAND=python run.py
      python: '3.6'
    - env: RUN_COMMAND=pytest test_web.py
      python: '3.6'    
env:
  matrix:
  - PYTEST_VERSION=3.7.3 PLUGINCOMPAT_SITE=http://plugincompat.herokuapp.com
  global:
    secure: "GYMlRL/xmnVjC2+RljsZj0aVNIOv/d7x36UBT5DNo+FlY4jGHin9nb3tckKzwh+VgNexcZ6O4UY6CRHZdTuwME1LlI4Mywx44y48oomA6lz1RMZI6OP9CF3SbcEl/Qs++sS/USEQNGB9IdWnF11dqbJ7XOI2E9CZk4bX9ZLQVdA="
script:
  - $RUN_COMMAND

branches:
  only:
    - master
    - /feature-.*/

Use separate jobs for testing and run.py
Use separate jobs for testing and run.py
