def test_no_recursion(self):
     mapping = {
         'A': ['B'],
         'B': ['C'],
     }
     self.assertEqual(
         zuul_config.get_dependencies('A', mapping, recurse=False),
         set(['B']))
    def test_cyclical_dependencies(self):
        """verifies that cyclical dependencies are possible"""

        mapping = {'Foo': ['Bar'], 'Bar': ['Foo']}

        self.assertEqual(
            zuul_config.get_dependencies('Foo', mapping),
            set(['Foo', 'Bar']),
        )
    def __str__(self):
        return "<gated repos>"


gatedrepos = GatedRepos(
    zuul_config.gatedextensions
    + ['skins/%s' % s for s in zuul_config.gatedskins])

test = unittest.TestCase('__init__')

# Retrieve dependencies of each projects and keep track of the gated project
# that depends on it.
gated_deps = {}
for gated_project in gatedrepos:
    deps = zuul_config.get_dependencies(
        gated_project,
        zuul_config.dependencies)
    for dep in deps:
        if dep not in gated_deps:
            gated_deps[dep] = [gated_project]
        else:
            gated_deps[dep].append(gated_project)


@attr('qa')
def test_deps_of_gated_are_in_gate():
    for (gated_dep, origin) in sorted(gated_deps.iteritems()):
        test.assertIn.__func__.description = (
            'Dependency of gated project is in gate: %s' % (gated_dep))
        yield (
            test.assertIn,
 def test_cyclical_dependencies_with_skins(self):
     mapping = {'Foo': ['skins/Vector'], 'skins/Vector': ['Foo']}
     self.assertEqual(zuul_config.get_dependencies('skins/Vector', mapping),
                      set(['Foo', 'skins/Vector']))
 def test_resolve_skin_on_skin(self):
     mapping = {'skins/Child': ['skin/Common']}
     self.assertEqual(zuul_config.get_dependencies('skins/Child', mapping),
                      set(['skin/Common']))
 def test_resolve_extension_on_extension(self):
     mapping = {'Foo': ['DepExtension']}
     self.assertEqual(zuul_config.get_dependencies('Foo', mapping),
                      set(['DepExtension']))
 def test_resolve_extension_on_skin(self):
     mapping = {'skins/Vector': ['Foo']}
     self.assertEqual(zuul_config.get_dependencies('skins/Vector', mapping),
                      set(['Foo']))