Skip to content

馃摑 docs: say that mode is read-only in the thread-local section - #716

Merged
gaborbernat merged 3 commits into
tox-dev:mainfrom
Gares95:docs/clarify-mode-read-only
Aug 25, 2026
Merged

馃摑 docs: say that mode is read-only in the thread-local section#716
gaborbernat merged 3 commits into
tox-dev:mainfrom
Gares95:docs/clarify-mode-read-only

Conversation

@Gares95

@Gares95 Gares95 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The thread-local section from #543 lists mode among the per-thread configuration values and then says that setting one of these properties from one thread leaves the value other threads see alone. 馃摑 mode has no setter, so lock.mode = ... raises AttributeError, and the sentence promises an operation the API does not offer.

mode stays in the list, because the context does hold it per thread. What changes is one added sentence naming the missing setter, in the thread_local parameter docs of BaseFileLock and BaseAsyncFileLock and as its own bullet in docs/concepts.rst. Splitting it into a separate bullet keeps the surrounding sentence about property setters reading the way it did before.

No behaviour change.

The thread-local documentation added in #543 lists mode among the per-thread
context fields and then says "Setting one of these properties from one thread
does not change the value seen by another thread". mode has no setter, so
assigning it raises AttributeError; the sentence describes an operation that
does not exist.

mode genuinely is stored per-thread in the context, so it stays in the list of
per-thread fields. The "setting" sentence in both the _api.py and asyncio.py
docstrings and in docs/concepts.rst now names the writable properties
(poll_interval, timeout, blocking, lifetime) and notes that mode is read-only
and fixed at construction.

Adds test_mode_is_read_only pinning the contract: mode assignment raises, and
the four writable properties each expose a setter, so the docs and the code
cannot drift again.
The nested parenthetical made the thread-local bullet hard to read and used
a hyphen as a dash, which nothing else in the docs does. Restore the original
sentence and state mode's read-only contract in a bullet of its own; the same
sentence goes into both thread_local docstrings.

test_mode_is_read_only asserted `.fset is not None` on the property objects,
which passes even when a setter is broken, and it repeated coverage that
test_thread_local_setter_visibility, test_subclass_compatibility and
test_lifetime_property_getter_setter already give. Drop that half and read
mode back instead, so a removed attribute cannot pass for a read-only one.
@gaborbernat gaborbernat changed the title docs: clarify that mode is read-only in the thread-local section 馃摑 docs: say that mode is read-only in the thread-local section Aug 24, 2026
@gaborbernat gaborbernat reopened this Aug 24, 2026
@gaborbernat
gaborbernat merged commit 5aeb9b6 into tox-dev:main Aug 25, 2026
84 of 92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants