diff options
author | Markus Holtermann <info@markusholtermann.eu> | 2014-09-26 00:24:17 +0200 |
---|---|---|
committer | Markus Holtermann <info@markusholtermann.eu> | 2014-10-30 00:17:29 +0100 |
commit | 85086c815873c4cf0bc2f1f2809119088cbe55f1 (patch) | |
tree | 1228f4757eaeea0ba9f11f40a95cebff6d770a0c /tests/migrations/test_graph.py | |
parent | 388c6038fdc7ce1d1314b1ffdf5943807f123977 (diff) | |
download | django-85086c815873c4cf0bc2f1f2809119088cbe55f1.tar.gz |
Fixed #23556 -- Raised a more meaningful error message when migrations refer to an unavailable node
Diffstat (limited to 'tests/migrations/test_graph.py')
-rw-r--r-- | tests/migrations/test_graph.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/migrations/test_graph.py b/tests/migrations/test_graph.py index 3fcdd12667..e70481a462 100644 --- a/tests/migrations/test_graph.py +++ b/tests/migrations/test_graph.py @@ -1,5 +1,5 @@ from django.test import TestCase -from django.db.migrations.graph import MigrationGraph, CircularDependencyError +from django.db.migrations.graph import CircularDependencyError, MigrationGraph, NodeNotFoundError class GraphTests(TestCase): @@ -156,10 +156,10 @@ class GraphTests(TestCase): graph = MigrationGraph() message = "Node ('app_b', '0001') not a valid node" - with self.assertRaisesMessage(ValueError, message): + with self.assertRaisesMessage(NodeNotFoundError, message): graph.forwards_plan(("app_b", "0001")) - with self.assertRaisesMessage(ValueError, message): + with self.assertRaisesMessage(NodeNotFoundError, message): graph.backwards_plan(("app_b", "0001")) def test_missing_parent_nodes(self): @@ -175,7 +175,7 @@ class GraphTests(TestCase): graph.add_dependency("app_a.0003", ("app_a", "0003"), ("app_a", "0002")) graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) msg = "Migration app_a.0001 dependencies reference nonexistent parent node ('app_b', '0002')" - with self.assertRaisesMessage(KeyError, msg): + with self.assertRaisesMessage(NodeNotFoundError, msg): graph.add_dependency("app_a.0001", ("app_a", "0001"), ("app_b", "0002")) def test_missing_child_nodes(self): @@ -186,5 +186,5 @@ class GraphTests(TestCase): graph = MigrationGraph() graph.add_node(("app_a", "0001"), None) msg = "Migration app_a.0002 dependencies reference nonexistent child node ('app_a', '0002')" - with self.assertRaisesMessage(KeyError, msg): + with self.assertRaisesMessage(NodeNotFoundError, msg): graph.add_dependency("app_a.0002", ("app_a", "0002"), ("app_a", "0001")) |