Month: August 2022

Basic Mocking with Pytest

Since I always seem to search for these examples over and over again, here it is, basic mocking with pytest. My example code is this (testmodule.py): It can be run: $ python3 testmodule.py In testfunc, sleeping $ Not surprisingly, running it takes about five seconds. The time.sleep() call simulates some long-running operation in the code. […]