Repository navigation
Commit cece2d6
authored
declare timeout ini options as float (#200)
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).1 parent 857be8f commit cece2d6
3 files changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
350 | 375 | | |
351 | 376 | | |
352 | 377 | | |
| |||
0 commit comments