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

Allow using -p no:legacypath with pytest >= 7 #213

Merged
merged 1 commit into from
Nov 22, 2023

Commits on Nov 22, 2023

  1. Allow using -p no:legacypath with pytest >= 7

    The `-p no:legacypath` option for `pytest` prevents using legacy
    `py.path` and forces using `pathlib` from the Python standard library
    instead. 07e12f4 (Remove usage of
    `py.path` with `pytest` 7) attempted to remove all uses of `py.path`
    with `pytest` >= 7 so that downstream packages could use that option,
    (at least with recent enough `pytest`). That commit introduced using
    `getattr()` to access the `path` attribute of `_pytest.nodes.Node`
    instances and falling back to the `fspath` attribute if `path` does not
    exist (which happens with `pytest` < 7). However, evaluating the
    `default` for `getattr()` then guarantees that `fspath` is accessed,
    which is incompatible with `-p no:legacypath`. The simplest way of
    avoiding accessing `fspath` is to use explicitly version-dependent code.
    eerovaher committed Nov 22, 2023
    Configuration menu
    Copy the full SHA
    eee62ee View commit details
    Browse the repository at this point in the history