FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

declare timeout ini options as float by zxyasfas · Pull Request #200 · pytest-dev/pytest-timeout · GitHub

Repository navigation

declare timeout ini options as float - #200

Merged
flub merged 1 commit into
pytest-dev:mainfrom
zxyasfas:toml-int-timeout
Aug 16, 2026
Merged

flub merged 1 commit into
pytest-dev:mainfrom
zxyasfas:toml-int-timeout

Conversation

Copy link
Copy Markdown
Contributor

Fixes #194.

With pytest 9's native [tool.pytest] table, timeout = 1200 (a TOML int) makes the whole session die at configure time:

INTERNALERROR> TypeError: pyproject.toml: config option 'timeout' expects a string, got int: 1200

because timeout and session_timeout are registered with the default string ini type. Registering them with type="float" fixes it, matching what the values actually are. Legacy [pytest] ini strings like timeout = 2.5 still parse the same way, and timeout = 0 still means disabled (the > 0 checks are unchanged).

One catch: type="float" was added to addini in pytest 8.4, and registering it under 8.0.x fails at plugin load, so this bumps the floor in setup.cfg to pytest>=8.4.0. If keeping 8.0 support matters more, the alternative is a try/except shim around the registration; happy to switch if you prefer that.

Added a regression test using makepyprojecttoml with int values for both options (skipped below pytest 9, where the native table doesn't exist). Suite passes locally on 3.12: 35 passed, 21 skipped (the pexpect spawn skips, this is a Windows machine).

flub left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks!

flub merged commit cece2d6 into pytest-dev:main Aug 16, 2026
10 checks passed

Copy link
Copy Markdown

That seems to be a breaking change - there is no way now to configure timeout in a way compatible with both 2.5.0 and 2.4.0:

2.5.0 strictly requires float:

INTERNALERROR> TypeError: /home/yurii/code/1.FastAPI/fastapi/pyproject.toml: config option 'timeout' expects a float, got str: '20.0'

2.4.0 strictly requires string:

INTERNALERROR> TypeError: /Users/runner/work/fastapi/fastapi/pyproject.toml: config option 'timeout' expects a string, got float: 20.0

@zxyasfas, @flub, am I missing something?

flub commented Aug 17, 2026

Copy link
Copy Markdown
Member

@YuriiMotov hum, sorry to miss that. I've yanked the 2.5 release on pypi until someone can look into this properly. Could you open a new issue for this?

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError: /path/to/pyproject.toml: config option 'timeout' expects a string, got int: 1200 in pytest 9.0

4 participants


Back | FazBrowse Home | New Git URL