Skip to content

faulthandler: register faulthandler_timeout as type=float - #15152

Closed
artem-sitd wants to merge 1 commit into
pytest-dev:mainfrom
artem-sitd:fix/faulthandler-timeout-toml-number
Closed

artem-sitd wants to merge 1 commit into
pytest-dev:mainfrom
artem-sitd:fix/faulthandler-timeout-toml-number

Conversation

@artem-sitd

Copy link
Copy Markdown

Fix #15132.

Problem

faulthandler_timeout was registered without a type, so it defaulted to string. In TOML configuration (pytest.toml / pyproject.toml) a native number — the documented and example form — was rejected:

ERROR: pytest.toml: config option 'faulthandler_timeout' expects a string, got int: 5

Change

Register faulthandler_timeout with type="float" (src/_pytest/faulthandler.py), matching its documented :type: and the float coercion already done in the faulthandler plugin. This is consistent with the other typed options (bool, int, float), all of which reject strings in TOML mode.

INI string values keep working (coerced str -> float in _getini_ini), so faulthandler_timeout = 5 in an .ini file is unchanged behaviour.

Tests

Added test_timeout_accepts_native_toml_numbers in testing/test_faulthandler.py; full test_faulthandler.py and TestConfigAPI pass.

Changelog fragment added as changelog/15132.bugfix.rst.

@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Oct 7, 2026
@The-Compiler

Copy link
Copy Markdown
Member

Duplicate of #15133 (and also unnecessarily beckwards incompatible for toml)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Native TOML numeric faulthandler_timeout is rejected

2 participants