Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using py.path #207

Merged
merged 2 commits into from
Nov 21, 2023
Merged

Avoid using py.path #207

merged 2 commits into from
Nov 21, 2023

Commits on Nov 14, 2023

  1. Replace uses of tmpdir fixture with tmp_path

    Both `tmpdir` and `tmp_path` fixtures create temporary directories, but
    the legacy `tmpdir` is based on third-party `py.path.local` objects
    whereas `tmp_path` is based on the standard library `pathlib.Path`.
    eerovaher committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    95c440b View commit details
    Browse the repository at this point in the history

Commits on Nov 20, 2023

  1. 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.
    eerovaher committed Nov 20, 2023
    Configuration menu
    Copy the full SHA
    07e12f4 View commit details
    Browse the repository at this point in the history