summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-20 07:12:45 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2006-06-20 07:12:45 +0000
commit3e97535907baa7b57c9bf322871ef6243e2045a9 (patch)
tree5582b52d992a79567ed86fdeb5bac5aa7f544eb8 /tests
parenta513fcb455c31e574821e966cd199efca52edd6d (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/regressiontests/initial_sql_regress/__init__.py0
-rw-r--r--tests/regressiontests/initial_sql_regress/models.py13
-rw-r--r--tests/regressiontests/initial_sql_regress/sql/simple.sql5
-rwxr-xr-xtests/runtests.py9
4 files changed, 25 insertions, 2 deletions
diff --git a/tests/regressiontests/initial_sql_regress/__init__.py b/tests/regressiontests/initial_sql_regress/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/regressiontests/initial_sql_regress/__init__.py
diff --git a/tests/regressiontests/initial_sql_regress/models.py b/tests/regressiontests/initial_sql_regress/models.py
new file mode 100644
index 0000000000..c4cf12bdf7
--- /dev/null
+++ b/tests/regressiontests/initial_sql_regress/models.py
@@ -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.
diff --git a/tests/regressiontests/initial_sql_regress/sql/simple.sql b/tests/regressiontests/initial_sql_regress/sql/simple.sql
new file mode 100644
index 0000000000..ac60c0c3d6
--- /dev/null
+++ b/tests/regressiontests/initial_sql_regress/sql/simple.sql
@@ -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');
+
diff --git a/tests/runtests.py b/tests/runtests.py
index bb0d15db8c..a43985175e 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -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):