O'Reilly logo
  • Chris Kang thinks this is interesting:

a_dir = tmpdir_factory.mktemp(​'mydir'​)

From

Cover of Python Testing with pytest

Note

Unlike "tmpdir", "tmpdir_factory" does not have a default directory already created and associated with the returned object.