How to use temporary directories and files in tests
You can use the tmp_path fixture which will provide a temporary directory unique to the test invocation, created in the base temporary directory.
tmp_path is a pathlib.Path object.
The tmpdir and tmpdir_factory fixtures
These days, it is preferred to use tmp_path and tmp_path_factory.
積ん読