From 7754498705540c81c40ec203a7bb429d59a07da5 Mon Sep 17 00:00:00 2001 From: Daniel Townsend Date: Wed, 7 Sep 2022 16:27:54 +0100 Subject: [PATCH] make foreign key migration test more thorough (#618) Shuffling the tables. --- .../apps/migrations/auto/integration/test_migrations.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/apps/migrations/auto/integration/test_migrations.py b/tests/apps/migrations/auto/integration/test_migrations.py index bb16a4f0a..5b6c58a6d 100644 --- a/tests/apps/migrations/auto/integration/test_migrations.py +++ b/tests/apps/migrations/auto/integration/test_migrations.py @@ -3,6 +3,7 @@ import datetime import decimal import os +import random import shutil import tempfile import time @@ -890,9 +891,13 @@ def test_foreign_keys(self): https://github.com/piccolo-orm/piccolo/issues/616 """ + # We'll shuffle them, to make it a more thorough test. + table_classes = random.sample( + self.table_classes, len(self.table_classes) + ) - self._test_migrations(table_snapshots=[self.table_classes]) - for table_class in self.table_classes: + self._test_migrations(table_snapshots=[table_classes]) + for table_class in table_classes: self.assertTrue(table_class.table_exists().run_sync())