Commit 4d4279f
authored
docs: fix the iterator order claim in api.rst (#533)
Follow-up to #524, which landed and shipped in 4.11.4 before this review
finished.
`docs/api.rst` now claims:
> User directories come first, then site directories, and each distinct
directory appears once.
The first half is wrong when `use_site_for_root` is active and the
process is root. `_iter_*_dirs` skips the user directory outright rather
than yielding it first, so under `multipath` the first entry is a site
directory that does not equal `user_*_dir`:
```pycon
>>> dirs = Unix(appname="foo", multipath=True, use_site_for_root=True) # as root, XDG_CONFIG_DIRS=/xdg/a:/xdg/b
>>> dirs.user_config_dir
'/xdg/a/foo:/xdg/b/foo'
>>> list(dirs.iter_config_dirs())
['/xdg/a/foo', '/xdg/b/foo']
```
`test_iter_dirs_as_root_with_multipath_skips_joined_user_dir` already
pins that behaviour, so the code is right and only the sentence is
wrong. "The most specific directory comes first" holds in every
configuration and still tells callers what they need to merge in the
right direction.
Two cleanups in the same area while I was there.
`test_use_site_for_root_bypasses_xdg_user_vars` kept an inline
`monkeypatch.delenv("XDG_RUNTIME_DIR", ...)` after gaining the
`_no_xdg_runtime_dir` fixture that does the same thing. And two test
signatures stayed exploded across four lines only because a magic
trailing comma survived the removal of their `mocker` and `monkeypatch`
parameters; both fit on one line now.
No behaviour change. `tox -e fix`, `-e type`, `-e docs` clean, full
suite passes.1 parent babf239 commit 4d4279f
4 files changed
Lines changed: 9 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
| 280 | + | |
282 | 281 | | |
283 | 282 | | |
284 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
| 230 | + | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
485 | 485 | | |
486 | 486 | | |
487 | 487 | | |
488 | | - | |
| 488 | + | |
489 | 489 | | |
490 | 490 | | |
491 | 491 | | |
| |||
500 | 500 | | |
501 | 501 | | |
502 | 502 | | |
503 | | - | |
504 | 503 | | |
505 | 504 | | |
506 | 505 | | |
| |||
539 | 538 | | |
540 | 539 | | |
541 | 540 | | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
| 541 | + | |
546 | 542 | | |
547 | 543 | | |
548 | 544 | | |
549 | 545 | | |
550 | 546 | | |
551 | 547 | | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
| 548 | + | |
556 | 549 | | |
557 | 550 | | |
558 | 551 | | |
| |||
573 | 566 | | |
574 | 567 | | |
575 | 568 | | |
576 | | - | |
| 569 | + | |
577 | 570 | | |
578 | 571 | | |
579 | 572 | | |
| |||
0 commit comments