コード例 #1
0
ファイル: multiplexer_unittest.py プロジェクト: ypu/avocado
class TestMultiplex(unittest.TestCase):
    tree = TREE
    mux_full = tuple(combine(multiplexer.tree2pools(tree)))

    def test_empty(self):
        act = tuple(combine(multiplexer.tree2pools(tree.TreeNode())))
        self.assertEqual(act, ((),))

    def test_partial(self):
        exp = (('intel', 'scsi'), ('intel', 'virtio'), ('amd', 'scsi'),
               ('amd', 'virtio'), ('arm', 'scsi'), ('arm', 'virtio'))
        act = tuple(combine(multiplexer.tree2pools(self.tree.children[0])))
        self.assertEqual(act, exp)

    def test_full(self):
        self.assertEqual(len(self.mux_full), 12)

    def test_create_variants(self):
        from_file = multiplexer.multiplex_yamls(['examples/mux-selftest.yaml'])
        self.assertEqual(self.mux_full, tuple(from_file))

    # Filters are tested in tree_unittests, only verify `multiplex_yamls` calls
    def test_filter_only(self):
        exp = (('intel', 'scsi'), ('intel', 'virtio'))
        act = tuple(multiplexer.multiplex_yamls(['examples/mux-selftest.yaml'],
                                                ('/hw/cpu/intel',
                                                 '/distro/fedora',
                                                 '/hw')))
        self.assertEqual(act, exp)

    def test_filter_out(self):
        act = tuple(multiplexer.multiplex_yamls(['examples/mux-selftest.yaml'],
                                                None,
                                                ('/hw/cpu/intel',
                                                 '/distro/fedora',
                                                 '/distro')))
        self.assertEqual(len(act), 4)
        self.assertEqual(len(act[0]), 3)
        str_act = str(act)
        self.assertIn('amd', str_act)
        self.assertIn('prod', str_act)
        self.assertNotIn('intel', str_act)
        self.assertNotIn('fedora', str_act)
コード例 #2
0
ファイル: multiplexer_unittest.py プロジェクト: ypu/avocado
 def test_partial(self):
     exp = (('intel', 'scsi'), ('intel', 'virtio'), ('amd', 'scsi'),
            ('amd', 'virtio'), ('arm', 'scsi'), ('arm', 'virtio'))
     act = tuple(combine(multiplexer.tree2pools(self.tree.children[0])))
     self.assertEqual(act, exp)
コード例 #3
0
ファイル: multiplexer_unittest.py プロジェクト: ypu/avocado
 def test_empty(self):
     act = tuple(combine(multiplexer.tree2pools(tree.TreeNode())))
     self.assertEqual(act, ((),))