From 493b26bbfc9cc0ad223ece131741cba2312ced0f Mon Sep 17 00:00:00 2001 From: "Ahmad A. Hussein" Date: Fri, 14 Aug 2020 22:07:37 +0200 Subject: Fixed #31888 -- Avoided module-level MySQL queries in tests. --- tests/serializers/test_data.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'tests/serializers') diff --git a/tests/serializers/test_data.py b/tests/serializers/test_data.py index 323cb13e82..9fbdd256fe 100644 --- a/tests/serializers/test_data.py +++ b/tests/serializers/test_data.py @@ -378,21 +378,20 @@ if connection.features.interprets_empty_strings_as_nulls: data[2]._meta.get_field('data').empty_strings_allowed and data[3] is None)] -# Regression test for #8651 -- a FK to an object with PK of 0 -# This won't work on MySQL without the NO_AUTO_VALUE_ON_ZERO SQL mode since it -# won't let you create an object with an autoincrement primary key of 0. -if connection.features.allows_auto_pk_0: - test_data.extend([ - (data_obj, 0, Anchor, "Anchor 0"), - (fk_obj, 465, FKData, 0), - ]) - class SerializerDataTests(TestCase): pass def serializerTest(self, format): + # FK to an object with PK of 0. This won't work on MySQL without the + # NO_AUTO_VALUE_ON_ZERO SQL mode since it won't let you create an object + # with an autoincrement primary key of 0. + if connection.features.allows_auto_pk_0: + test_data.extend([ + (data_obj, 0, Anchor, 'Anchor 0'), + (fk_obj, 465, FKData, 0), + ]) # Create all the objects defined in the test data objects = [] -- cgit v1.2.1