MCPcopy
hub / github.com/django/django / test_infinite_loop

Method test_infinite_loop

tests/migrations/test_graph.py:408–439  ·  view source on GitHub ↗

Tests a complex dependency graph: app_a: 0001 <- \ app_b: 0001 <- x 0002 <- / \ app_c: 0001<- <------------- x 0002 And apply squashing on app_c.

(self)

Source from the content-addressed store, hash-verified

406 self.assertNotIn(other_replaced_node, child_node.parents)
407
408 def test_infinite_loop(self):
409 """
410 Tests a complex dependency graph:
411
412 app_a: 0001 <-
413 \
414 app_b: 0001 <- x 0002 <-
415 / \
416 app_c: 0001<- <------------- x 0002
417
418 And apply squashing on app_c.
419 """
420 graph = MigrationGraph()
421
422 graph.add_node(("app_a", "0001"), None)
423 graph.add_node(("app_b", "0001"), None)
424 graph.add_node(("app_b", "0002"), None)
425 graph.add_node(("app_c", "0001_squashed_0002"), None)
426
427 graph.add_dependency(
428 "app_b.0001", ("app_b", "0001"), ("app_c", "0001_squashed_0002")
429 )
430 graph.add_dependency("app_b.0002", ("app_b", "0002"), ("app_a", "0001"))
431 graph.add_dependency("app_b.0002", ("app_b", "0002"), ("app_b", "0001"))
432 graph.add_dependency(
433 "app_c.0001_squashed_0002",
434 ("app_c", "0001_squashed_0002"),
435 ("app_b", "0002"),
436 )
437
438 with self.assertRaises(CircularDependencyError):
439 graph.ensure_not_cyclic()
440
441 def test_stringify(self):
442 graph = MigrationGraph()

Callers

nothing calls this directly

Calls 4

add_nodeMethod · 0.95
add_dependencyMethod · 0.95
ensure_not_cyclicMethod · 0.95
MigrationGraphClass · 0.90

Tested by

no test coverage detected