Commit cb4a5e9
authored
Don't run
* Add test for repeated _pre_setup on transactional tests
Records who calls _pre_setup(). A plain django_db test is set up once, by us. A
django_db(transaction=True) test is set up twice: TransactionTestCase.setUpClass()
runs _pre_setup() eagerly and we then run it again.
* Don't run _pre_setup() twice for transactional tests
TransactionTestCase.setUpClass() runs _pre_setup() eagerly and flags it in
_pre_setup_ran_eagerly, which unittest.TestCase.run() clears instead of setting
the test up again. We drive the test case ourselves, so do the same.
Repeating _pre_setup() redid the whole fixture setup - serialized rollback
restore, fixtures, sequence reset - on every transactional test. With
available_apps it also sent setting_changed(enter=True) and post_migrate twice
against the single exit in _post_teardown._pre_setup() twice for transactional tests (#1293)1 parent 9d6570a commit cb4a5e9
3 files changed
Lines changed: 45 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
293 | 296 | | |
294 | 297 | | |
295 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
466 | 506 | | |
467 | 507 | | |
468 | 508 | | |
| |||
0 commit comments