mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #32114 -- Fixed parallel test crash on non-picklable objects in subtests.
This commit is contained in:
committed by
Mariusz Felisiak
parent
a269d8d1d8
commit
c09e8f5fd8
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user