Another frequent need when writing applications used by many users is to make sure that they perform in a reasonable way and, hence, that our users don't have to wait too long for something to happen. This is usually achieved by benchmarking core paths of our code base to make sure that slowdowns aren't introduced in those functions and methods. Once we have a good benchmark suite, all we have to do is rerun it on every code change and compare the results to previous runs. If nothing got slower, we are good to go.
PyTest has a pytest-benchmark plugin that makes it easy to create and run benchmarks as parts of our test suite. Like any other Python distribution, we can install pytest-benchmark through pip:
$ pip install pytest-benchmark
Once we have it installed, we can start organizing our benchmarks in their own dedicated directory. This way, they don't mix with tests, as usually we don't want to run benchmarks on every test...