Writing clean tests with pytest¶
The pytest framework allows for cleaner tests to be written but also for efficient running of tests with multiple plugins.
The pytest-cov plugin allows you to run coverage checks with pytest.
The pytest-flake8 plugin allows you to run flake8 checks with pytest.
The pytest-randomly plugin does two things (for Nashpy):
It randomly shuffles the order of tests: this ensures that tests passing is not dependent on the order in which they run.
It seeds stochastic tests to ensure that any exceptions are reproducible. In practice this has little effect here as ideally stochastic tests are seeded or written with hypothesis.
The pytest-sugar plugin changes the look of pytest.
The Talk Python to Me podcast episode 267 featured a discussion of a number of pytest plugins: https://talkpython.fm/episodes/show/267/15-amazing-pytest-plugins