How to write performance test¶
It's really easy. The pytest session includes the plugin pytest-benchmark. With this writing a performance test is simply writing functions like following:
The example here does attaching of one observer with special interest to one subject; the notification part is the call that will be measured. You simply define a function passing it to the benchmark function.
It's important that you write those tests for small scenarios since the scaling is automatically tested by the bechmark framework.
For more details please read here: https://pytest-benchmark.readthedocs.io/en/latest/.