pytest-datafiles · PyPI is nice but returns a
py.path instead of
Tried to write something to make it convert automatically.
ASSETS_DIR = Path(__file__).parent / "assets" @pytest.fixture def pfiles(datafiles): # Fixture that converts pytest-datafiles' py.path into a pathlib.Path return Path(str(datafiles)) @pytest.mark.datafiles(PROJ_DIR) def test_read_meta_json(pfiles): assert do_sth_with_file(pfiles)
First nontrivial fixture I write, maybe a really bad idea to do it like that. This feels like a general use case and someone had to have had this problem