Loading django/core/management.py +3 −2 Original line number Diff line number Diff line Loading @@ -334,8 +334,9 @@ def get_sql_initial_data_for_model(model): # Some backends can't execute more than one SQL statement at a time, # so split into separate statements. sql_expr = re.compile( r"""( # each statement is... (?: # one or more chunks of ... r"""( # each statement ... [^\r\n;] # starts with something other than a line ending or ';' (?: # then has one or more chunks of ... (?:[^;'"]+) # not the end of a statement or start of a quote | (?:'[^']*') # something in single quotes | (?:"[^"]*") # something in double quotes Loading tests/regressiontests/initial_sql_regress/__init__.py 0 → 100644 +0 −0 Empty file added. tests/regressiontests/initial_sql_regress/models.py 0 → 100644 +13 −0 Original line number Diff line number Diff line """ Regression tests for initial SQL insertion. """ from django.db import models class Simple(models.Model): name = models.CharField(maxlength = 50) API_TESTS = "" # NOTE: The format of the included SQL file for this test suite is important. # It must end with a trailing newline in order to test the fix for #2161. tests/regressiontests/initial_sql_regress/sql/simple.sql 0 → 100644 +5 −0 Original line number Diff line number Diff line INSERT INTO initial_sql_regress_simple (name) VALUES ('John'); INSERT INTO initial_sql_regress_simple (name) VALUES ('Paul'); INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo'); INSERT INTO initial_sql_regress_simple (name) VALUES ('George'); tests/runtests.py +7 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,13 @@ ALWAYS_INSTALLED_APPS = [ ] def get_test_models(): return [(MODEL_TESTS_DIR_NAME, f) for f in os.listdir(MODEL_TEST_DIR) if not f.startswith('__init__') and not f.startswith('.')] +\ [(REGRESSION_TESTS_DIR_NAME, f) for f in os.listdir(REGRESSION_TEST_DIR) if not f.startswith('__init__') and not f.startswith('.')] models = [] for loc in MODEL_TESTS_DIR_NAME, REGRESSION_TESTS_DIR_NAME: for f in os.listdir(loc): if f.startswith('__init__') or f.startswith('.') or f.startswith('sql'): continue models.append((loc, f)) return models class DjangoDoctestRunner(doctest.DocTestRunner): def __init__(self, verbosity_level, *args, **kwargs): Loading Loading
django/core/management.py +3 −2 Original line number Diff line number Diff line Loading @@ -334,8 +334,9 @@ def get_sql_initial_data_for_model(model): # Some backends can't execute more than one SQL statement at a time, # so split into separate statements. sql_expr = re.compile( r"""( # each statement is... (?: # one or more chunks of ... r"""( # each statement ... [^\r\n;] # starts with something other than a line ending or ';' (?: # then has one or more chunks of ... (?:[^;'"]+) # not the end of a statement or start of a quote | (?:'[^']*') # something in single quotes | (?:"[^"]*") # something in double quotes Loading
tests/regressiontests/initial_sql_regress/models.py 0 → 100644 +13 −0 Original line number Diff line number Diff line """ Regression tests for initial SQL insertion. """ from django.db import models class Simple(models.Model): name = models.CharField(maxlength = 50) API_TESTS = "" # NOTE: The format of the included SQL file for this test suite is important. # It must end with a trailing newline in order to test the fix for #2161.
tests/regressiontests/initial_sql_regress/sql/simple.sql 0 → 100644 +5 −0 Original line number Diff line number Diff line INSERT INTO initial_sql_regress_simple (name) VALUES ('John'); INSERT INTO initial_sql_regress_simple (name) VALUES ('Paul'); INSERT INTO initial_sql_regress_simple (name) VALUES ('Ringo'); INSERT INTO initial_sql_regress_simple (name) VALUES ('George');
tests/runtests.py +7 −2 Original line number Diff line number Diff line Loading @@ -34,8 +34,13 @@ ALWAYS_INSTALLED_APPS = [ ] def get_test_models(): return [(MODEL_TESTS_DIR_NAME, f) for f in os.listdir(MODEL_TEST_DIR) if not f.startswith('__init__') and not f.startswith('.')] +\ [(REGRESSION_TESTS_DIR_NAME, f) for f in os.listdir(REGRESSION_TEST_DIR) if not f.startswith('__init__') and not f.startswith('.')] models = [] for loc in MODEL_TESTS_DIR_NAME, REGRESSION_TESTS_DIR_NAME: for f in os.listdir(loc): if f.startswith('__init__') or f.startswith('.') or f.startswith('sql'): continue models.append((loc, f)) return models class DjangoDoctestRunner(doctest.DocTestRunner): def __init__(self, verbosity_level, *args, **kwargs): Loading