The following are some short topics and tips that did not fit into the previous sections, but that I think are worth mentioning.
Tips/discussion
When to use fixtures, as opposed to simple functions
Sometimes, all you need is to construct a simple object for your tests, and arguably this can be done in a plain function, not necessarily needing to be implemented as a fixture. Suppose we have a WindowManager class, that does not receive any parameters:
class WindowManager:
...
One way to use it in our tests would be to write a fixture:
@pytest.fixture
def manager():
return WindowManager()
def test_windows_creation(manager):
window = manager.new_help_window("pipes_help.rst")
assert window.title() == "...