Trim does not remove dependencies but does remove unwanted apps.
(self)
| 1220 | ) |
| 1221 | |
| 1222 | def test_trim_apps(self): |
| 1223 | """ |
| 1224 | Trim does not remove dependencies but does remove unwanted apps. |
| 1225 | """ |
| 1226 | # Use project state to make a new migration change set |
| 1227 | before = self.make_project_state([]) |
| 1228 | after = self.make_project_state( |
| 1229 | [self.author_empty, self.other_pony, self.other_stable, self.third_thing] |
| 1230 | ) |
| 1231 | autodetector = MigrationAutodetector( |
| 1232 | before, after, MigrationQuestioner({"ask_initial": True}) |
| 1233 | ) |
| 1234 | changes = autodetector._detect_changes() |
| 1235 | # Run through arrange_for_graph |
| 1236 | graph = MigrationGraph() |
| 1237 | changes = autodetector.arrange_for_graph(changes, graph) |
| 1238 | changes["testapp"][0].dependencies.append(("otherapp", "0001_initial")) |
| 1239 | changes = autodetector._trim_to_apps(changes, {"testapp"}) |
| 1240 | # Make sure there's the right set of migrations |
| 1241 | self.assertEqual(changes["testapp"][0].name, "0001_initial") |
| 1242 | self.assertEqual(changes["otherapp"][0].name, "0001_initial") |
| 1243 | self.assertNotIn("thirdapp", changes) |
| 1244 | |
| 1245 | def test_custom_migration_name(self): |
| 1246 | """Tests custom naming of migrations for graph matching.""" |
nothing calls this directly
no test coverage detected