mirror of
https://github.com/django/django.git
synced 2025-11-20 03:30:00 +00:00
Fixed #32114 -- Fixed parallel test crash on non-picklable objects in subtests.
This commit is contained in:
parent
a269d8d1d8
commit
c09e8f5fd8
3 changed files with 56 additions and 1 deletions
|
|
@ -1,12 +1,20 @@
|
|||
import pickle
|
||||
from functools import wraps
|
||||
|
||||
from django.db import IntegrityError, connections, transaction
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
from django.test.testcases import DatabaseOperationForbidden, TestData
|
||||
from django.test.testcases import DatabaseOperationForbidden, SimpleTestCase, TestData
|
||||
|
||||
from .models import Car, Person, PossessedCar
|
||||
|
||||
|
||||
class TestSimpleTestCase(SimpleTestCase):
|
||||
def test_is_picklable_with_non_picklable_properties(self):
|
||||
"""ParallelTestSuite requires that all TestCases are picklable."""
|
||||
self.non_picklable = lambda: 0
|
||||
self.assertEqual(self, pickle.loads(pickle.dumps(self)))
|
||||
|
||||
|
||||
class TestTestCase(TestCase):
|
||||
@skipUnlessDBFeature("can_defer_constraint_checks")
|
||||
@skipUnlessDBFeature("supports_foreign_keys")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue