diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2013-07-02 11:51:38 +0100 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2013-07-02 11:51:38 +0100 |
| commit | 9ef715d256938bd5d2c95a88ce0479aa5e493981 (patch) | |
| tree | 316503228a7843e2e35f1d9e1849b13fa2209520 | |
| parent | f343cbf06cba0e2ace0157224f85b89488093fa1 (diff) | |
Fix some bad test running under PostgreSQL
| -rw-r--r-- | tests/migrations/test_operations.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py index b2912de53c..a6d57ceb7a 100644 --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1,5 +1,6 @@ from django.test import TestCase from django.db import connection, models, migrations +from django.db.transaction import atomic from django.db.utils import IntegrityError from django.db.migrations.state import ProjectState @@ -38,7 +39,7 @@ class OperationTests(TestCase): "Pony", [ ("id", models.AutoField(primary_key=True)), - ("pink", models.BooleanField(default=True)), + ("pink", models.IntegerField(default=3)), ("weight", models.FloatField()), ], ) @@ -232,7 +233,8 @@ class OperationTests(TestCase): operation.database_forwards("test_alunto", editor, project_state, new_state) cursor.execute("INSERT INTO test_alunto_pony (id, pink, weight) VALUES (1, 1, 1)") with self.assertRaises(IntegrityError): - cursor.execute("INSERT INTO test_alunto_pony (id, pink, weight) VALUES (2, 1, 1)") + with atomic(): + cursor.execute("INSERT INTO test_alunto_pony (id, pink, weight) VALUES (2, 1, 1)") cursor.execute("DELETE FROM test_alunto_pony") # And test reversal with connection.schema_editor() as editor: |
