Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python version and environment matrix

  • matrix
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

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
[pytest]
markers =
  postgresql
  mysql