summaryrefslogtreecommitdiff
path: root/tests/regressiontests/datatypes/models.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-09-01 17:48:39 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-09-01 17:48:39 +0000
commite545058ba94f5f5736a5db82e6ba5883d8071485 (patch)
treedfc4ea1f77c210c1dcc699d31597318602c2fdd5 /tests/regressiontests/datatypes/models.py
parent15206298edfd988922654293e1c4cc91cd687044 (diff)
Fixed #8354: the MySQL backend no longer raises a cryptic error. Instead, it raises a less-cryptic error. Obiously this isn't a perfect solution by any means, but it'll do until we can revisit timezone handling in the future.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8802 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/datatypes/models.py')
-rw-r--r--tests/regressiontests/datatypes/models.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/regressiontests/datatypes/models.py b/tests/regressiontests/datatypes/models.py
index 9ebb6402e2..7e76d6a669 100644
--- a/tests/regressiontests/datatypes/models.py
+++ b/tests/regressiontests/datatypes/models.py
@@ -83,3 +83,16 @@ datetime.datetime(2007, 4, 20, 16, 19, 59)
[]
"""}
+
+# Regression test for #8354: the MySQL backend should raise an error if given
+# a timezone-aware datetime object.
+if settings.DATABASE_ENGINE == 'mysql':
+ __test__['API_TESTS'] += """
+>>> from django.utils import tzinfo
+>>> dt = datetime.datetime(2008, 8, 31, 16, 20, tzinfo=tzinfo.FixedOffset(0))
+>>> d = Donut(name='Bear claw', consumed_at=dt)
+>>> d.save()
+Traceback (most recent call last):
+ ....
+ValueError: MySQL backend does not support timezone-aware datetimes.
+"""