Now that we know that conftest.py allows us to customize how our test suite should behave, the next step is to notice that pytest allows us to also change how our fixtures behave as well.
For example, the fizzbuzz program is expected to print "fizz" on every number divisible by 3, print "buzz" on every number divisible by 5, and print "fizzbuzz" on every number divisible by both.
To implement this, we could have outfizz and outbuzz functions that print "fizz" or "buzz" without a newline. This allows us to call each one of them to print fizz or buzz and to call both functions one after the other to print fizzbuzz.
To test this behavior, we could have a tests/unit/test_output.py module containing all the tests for our output utilities. For outfizz and outbuzz, we could write the tests as follows:
from fizzbuzz import outfizz, outbuzz, endnum
def test_outfizz(capsys):
outfizz()
out, _ = capsys.readouterr()
assert...