Commit eee62ee
committed
Allow using
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.-p no:legacypath with pytest >= 71 parent bad8fb7 commit eee62ee
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| 60 | + | |
| 61 | + | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
| |||
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | | - | |
68 | | - | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
71 | 74 | | |
| |||
0 commit comments