Setting Up a SQLAlchemy and Pytest Based Test Suite

✨ This is an improved article of the previous Python Transactional Tests Using SQL Alchemy, Pytest, and Factory Boy article.

In this post I will show you how you can setup a Pytest test suite that automatically sets up and teardowns your database using SQAlchemy on each test run. It will also provide transactional tests capabilities as described in Python Transactional Tests Using SQL Alchemy, Pytest, and Factory Boy.

sqlalchemy python pytest factoryboy

How to create a 3 Stage Deployment Pipeline With Github Actions

In this post I will show you how to setup a nice 3 stage deployment pipeline that will lint and test your code before deploying to a specific stage, using Github Actions

I will be simulating a Python application for this post, so you should modify the Python related stuff according to your project.

🔧 Build And Test Workflow

This workflow will lint, type check, and test the project before deploying to any stage. Create a .github/workflows/build-and-test.yml file:

github actions

Python Transactional Tests Using SQL Alchemy, Pytest, and Factory Boy

🆕 Read the newer and improved post Setting Up a SQLAlchemy and Pytest Based Test Suite

📅 Last Updated on November 26 2021

Knowing how to integrate SQLAlchemy for your automated tests can be a bit tricky. Even after reading several blog posts on how to implement transactional tests with SQLAlchemy 1.3 and Pytest, it took me a bit of time to make it all play nicely with Factory Boy.

In this post I will teach you how you that is achieved.

python sqlalchemy pytest factoryboy
Older Posts →