1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #32114 -- Fixed parallel test crash on non-picklable objects in subtests.

This commit is contained in:
David Wobrock
2023-12-27 17:02:27 +01:00
committed by Mariusz Felisiak
parent a269d8d1d8
commit c09e8f5fd8
3 changed files with 56 additions and 1 deletions

View File

@@ -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")