Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Also test failure case of ProjectState dependency resolution

  • Loading branch information...
commit be983ee4031bb91f0a56e310633adbc50d9221a3 1 parent cdeff3a
@andrewgodwin andrewgodwin authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 tests/migrations/test_state.py
View
11 tests/migrations/test_state.py
@@ -1,7 +1,7 @@
from django.test import TestCase
from django.db import models
from django.db.models.loading import BaseAppCache
-from django.db.migrations.state import ProjectState, ModelState
+from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError
class StateTests(TestCase):
@@ -166,3 +166,12 @@ class Meta:
project_state.add_model_state(ModelState.from_model(F))
final_app_cache = project_state.render()
self.assertEqual(len(final_app_cache.get_models()), 6)
+
+ # Now make an invalid ProjectState and make sure it fails
+ project_state = ProjectState()
+ project_state.add_model_state(ModelState.from_model(A))
+ project_state.add_model_state(ModelState.from_model(B))
+ project_state.add_model_state(ModelState.from_model(C))
+ project_state.add_model_state(ModelState.from_model(F))
+ with self.assertRaises(InvalidBasesError):
+ project_state.render()
Please sign in to comment.
Something went wrong with that request. Please try again.