Workflows and Pytest

Workflows:

  • Configured in .github/workflows

  • Formatting-linting.yml
    • Executes linting provided by flake8 and black, configured in .flake8

  • run-pytests.yml
    • Executed tests defined in /tests/automated_tests/

PyTest

pip install -U pytest
  • Executed in Terminal with

pytest tests/automated_tests/
  • pytest finds test methods through the test_ prefix

Test Structure

Structure of a test execution should follow Given-When-Then

Test Environment

Make sure to set the Environment, some methods need to be called with app_context:

with app.app_context()

Notes:

  • Sometimes the DB is not updated when within the same app_context block, try creating another block and call from there.

  • Mocks do not work within async celery task, due to it running on an external broker.

Further documentation can be found in the pytest documentation .