test: Convert interleaved migration failure to a warning. (#4301)

This commit is contained in:
Robert Sparks 2022-08-02 10:23:12 -05:00 committed by GitHub
parent 73931c2ed7
commit 1b64231e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,6 +52,7 @@ import tempfile
import copy
import factory.random
import urllib3
import warnings
from urllib.parse import urlencode
from fnmatch import fnmatch
@ -663,7 +664,7 @@ class CoverageTest(unittest.TestCase):
break
mixed = [ unreleased[i] for i in range(s+1,len(unreleased)) if unreleased[i][1] != unreleased[i-1][1] ]
if len(mixed) > 1 and not self.runner.permit_mixed_migrations:
raise self.failureException('Found interleaved schema and data operations in unreleased migrations;'
warnings.warn('Found interleaved schema and data operations in unreleased migrations;'
' please see if they can be re-ordered with all data migrations before the schema migrations:\n'
+('\n'.join([' %-6s: %-12s, %s (%s)'% (op, node.key[0], node.key[1], nm) for (node, op, nm) in unreleased ])))