Pytest: Introduce tmp_path fixture

Created on 14 Sep 2018  路  5Comments  路  Source: pytest-dev/pytest

After the excellent brain-storming with @gaborbernat in https://github.com/pytest-dev/pytest/pull/2230#issuecomment-421454260, I came to realize we already depend now on pathlib2, so we could already introduce a new tmp_path fixture which works exactly like tmpdir, but returns a pathlib.Path instance.

Even if we don't ever adopt the pathlib-switch discussed in #2230, still seems like a good idea given that pathlib is part of the standard library, so makes perfect sense.

easy enhancement feature-branch

Most helpful comment

Closing this as #3988 was merged.

All 5 comments

For completeness, we should include a path_factory, similar to tmpdir_factory.

Hi, I want to try to implement it.
It's one of my first github participation.

To make sure I understand correctly the request. you want to create a new fixture to create a tmpdir but to return pathlib.Path object instead of py.path

full stop - im currently porting the complete internals of tmpdir to pathlib - i will open a pr within the next 12 hours

3988 fixes this one

Closing this as #3988 was merged.

Was this page helpful?
0 / 5 - 0 ratings