mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #2161 -- handle trailing newlines in initial SQL data. Includes
regression test. Thanks to russellm. git-svn-id: http://code.djangoproject.com/svn/django/trunk@3177 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a513fcb455
commit
3e97535907
5 changed files with 28 additions and 4 deletions
0
tests/regressiontests/initial_sql_regress/__init__.py
Normal file
0
tests/regressiontests/initial_sql_regress/__init__.py
Normal file
13
tests/regressiontests/initial_sql_regress/models.py
Normal file
13
tests/regressiontests/initial_sql_regress/models.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
"""
|
||||
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.
|
5
tests/regressiontests/initial_sql_regress/sql/simple.sql
Normal file
5
tests/regressiontests/initial_sql_regress/sql/simple.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
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');
|
||||
|
|
@ -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…
Add table
Add a link
Reference in a new issue