Commit fe63e34
authored
Handle bound fixture methods correctly (#439)
When the current test request references an instance, bind the fixture function to that instance. When the unittest flag is set, this happens unconditionally, otherwise only if:
- the fixture wasn't bound already
- the fixture is bound to a compatible instance (the request.instance object has the same type or is a subclass of that type).
This follows what pytest does in such cases, exactly.1 parent 38fc032 commit fe63e34
File tree
4 files changed
+70
-15
lines changed- pytest_asyncio
- tests/async_fixtures
4 files changed
+70
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
235 | 234 | | |
236 | 235 | | |
237 | 236 | | |
| |||
249 | 248 | | |
250 | 249 | | |
251 | 250 | | |
252 | | - | |
253 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
254 | 274 | | |
255 | 275 | | |
256 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
257 | 280 | | |
258 | 281 | | |
259 | | - | |
| 282 | + | |
260 | 283 | | |
261 | 284 | | |
262 | 285 | | |
| |||
279 | 302 | | |
280 | 303 | | |
281 | 304 | | |
282 | | - | |
| 305 | + | |
283 | 306 | | |
284 | 307 | | |
285 | | - | |
286 | | - | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
287 | 312 | | |
288 | 313 | | |
289 | | - | |
290 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
291 | 320 | | |
292 | 321 | | |
293 | 322 | | |
294 | 323 | | |
295 | 324 | | |
296 | | - | |
| 325 | + | |
297 | 326 | | |
298 | 327 | | |
299 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments