Commit b8260f8
committed
fix(ci): stop a filterwarnings class path aborting the 3.9/3.10 test session
`[tool.pytest.ini_options] filterwarnings` carried
`ignore::starlette.exceptions.StarletteDeprecationWarning`. pytest resolves
that class while parsing config, so on the 3.9/3.10 matrix legs - where the
resolvable starlette predates the class - it raised
AttributeError: module 'starlette.exceptions' has no attribute
'StarletteDeprecationWarning'
and aborted the whole session with a usage error (exit 4) before collecting a
single test.
Register the filter from conftest instead, where a missing class degrades to a
no-op. It goes through `addinivalue_line` rather than a module-level
`warnings.filterwarnings` call because pytest runs each test inside its own
`catch_warnings()` seeded from the ini filters, which discards anything
registered at conftest import time. The warning subclasses UserWarning, not
DeprecationWarning, so there is no stdlib category to substitute.
Suppression behaviour is unchanged on 3.11+; verified the warnings summary is
empty again.1 parent 17e7e6c commit b8260f8
2 files changed
Lines changed: 28 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
178 | 180 | | |
179 | 181 | | |
180 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
88 | 111 | | |
89 | 112 | | |
90 | 113 | | |
| |||
0 commit comments