MCPcopy
hub / github.com/deadc0de6/dotdrop / test_include_loop_detection

Method test_include_loop_detection

tests/test_yamlcfg.py:254–274  ·  view source on GitHub ↗

detect include cycles between profiles

(self)

Source from the content-addressed store, hash-verified

252 self.assertEqual(cfg.variables.get('from_right'), 'R')
253
254 def test_include_loop_detection(self):
255 """detect include cycles between profiles"""
256 tmp = get_tempdir()
257 self.assertTrue(os.path.exists(tmp))
258 self.addCleanup(clean, tmp)
259
260 confpath = create_fake_config(tmp,
261 configname=self.CONFIG_NAME,
262 dotpath=self.CONFIG_DOTPATH,
263 backup=self.CONFIG_BACKUP,
264 create=self.CONFIG_CREATE)
265
266 content = yaml_load(confpath)
267 content['profiles'] = {
268 'a': {'include': ['b']},
269 'b': {'include': ['a']}
270 }
271 yaml_dump(content, confpath)
272
273 with self.assertRaises(YamlException):
274 Cfg(confpath, profile='a', debug=True)
275
276 def test_include_dag_user_example(self):
277 """user-reported DAG includes should not be treated as loops"""

Callers

nothing calls this directly

Calls 4

get_tempdirFunction · 0.90
create_fake_configFunction · 0.90
yaml_loadFunction · 0.90
yaml_dumpFunction · 0.90

Tested by

no test coverage detected