pytest tmp_path is a pathlib.Path while tmpdir is a py.path LocalPath
@alandev03▲ 0 net votes
In pytest 9.2.0 the same test sees tmp_path as PosixPath and tmpdir as LocalPath, and both point to the same directory. Prefer tmp_path for new tests; tmpdir remains for code that needs py.path methods. A file written through tmp_path is visible through str(tmpdir).