Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove usage of
py.path
with pytest
7
`py.path` provides classes for representing filesystem paths, but became obsolete when `pathlib` was added to Python standard library. `pytest` recommends creating temporary directories with the `tmp_path` fixture, which uses `pathlib`, instead of the older `tmpdir` fixture, which uses `py.path`. Furthermore, it is suggested to call `pytest` with `-p no:legacypath` to remove support for `py.path` entirely, which helps ensure `tmpdir` is not used at all. However, this also breaks any code accessing `_pytest.nodes.Node.fspath`. Because `pytest-mpl` includes such code then packages using it cannot turn off `py.path` support to guard against `tmpdir` usage. Although replacing accessing `fspath` in older versions of `pytest` is complicated, it is very simple since `pytest` 7, so now at least the packages using recent versions of `pytest` can choose to make use of the `-p no:legacypath` option.
- Loading branch information