Testing Tips: Avoid sleep in tests

Hi 👋, In this article I wanna show a testing tip that I’ve recently learned myself by reading Software Engineering at Google: Lessons Learned from Programming Over Time. The technique improved the way I write unit tests. When I’m writing bigger unit tests, I have execute something in the background, like for example publishing a message to a message broker, wait for the message to be published and then consume it to test that what I published is correct....

July 12, 2022 · 4 min · Denis Nuțiu

Pytest Fixtures and Yield

Hi 👋 In this short article I want to explain the use of the yield keyword in pytest fixtures. What is pytest? Pytest is a complex python framework used for writing tests. It has lots of advanced features and it supports plugins. Many projects prefer pytest in addition to Python’s unitttest library. What is a fixture? A test fixture is a piece of code that fixes some common functionality that is required for writing the unit tests....

December 14, 2021 · 3 min · Denis Nuțiu

Testing Python projects with Tox

Hi 👋 In this article I will show you how to test your Python projects with Tox. Introduction Tox is a tool for automating testing in Python, their vision is to standardize the testing process. It can be used to easily test your project using multiple Python interpreters and run various commands. Getting Started To get started all you need to add to your project is a tox.ini file. To simplify running the tests we will make use of the following Dockerfile, which contains Python interpreters for 3....

July 29, 2021 · 3 min · Denis Nuțiu