Python version and environment matrix



examples/python-env-version-matrix/.travis.yml
language: python
script: pytest -s -m $DATABASE

python:
  - "3.7"
  - "3.8"

env:
    - DATABASE=postgresql
    - DATABASE=mysql

matrix:
  exclude:
  - python: "3.7"
    env: DATABASE=mysql

examples/python-env-version-matrix/test_python.py
import os
import pytest

print(f"DATABASE = {os.environ['DATABASE']}")

@pytest.mark.postgresql
def test_postgresql():
    print("Testing postgresql")
    pass

@pytest.mark.mysql
def test_mysql():
    print("Testing mysql")
    pass

examples/python-env-version-matrix/pytest.ini
[pytest]
markers =
  postgresql
  mysql