Exemplo n.º 1
0
    def make_driver(self):
        driver_exe = file_types.Executable(self.Path('driver'), None)
        driver_exe.creator = 'creator'
        driver = self.context['test_driver'](driver_exe)

        test_exe = file_types.Executable(self.Path('test'), None)
        test_exe.creator = 'creator'
        self.context['test'](test_exe, driver=driver)
        return driver_exe, test_exe
Exemplo n.º 2
0
    def test_args(self):
        prog = file_types.Executable(Path('prog'), None)
        case = self.context['test']([prog, '--foo'])

        self.assertEqual(case.cmd, [prog, '--foo'])
        self.assertEqual(case.inputs, [])
        self.assertEqual(case.env, {})
        self.assertEqual(self.build['tests'].tests, [case])
Exemplo n.º 3
0
    def test_basic(self):
        prog = file_types.Executable(Path('prog'), None)
        case = self.builtin_dict['test'](prog)

        self.assertEqual(case.cmd, [prog])
        self.assertEqual(case.inputs, [])
        self.assertEqual(case.env, {})
        self.assertEqual(self.build['tests'].tests, [case])
Exemplo n.º 4
0
    def test_environment(self):
        prog = file_types.Executable(Path('prog'), None)
        case = self.context['test'](prog, environment={'VAR': 'foo'})

        self.assertEqual(case.cmd, [prog])
        self.assertEqual(case.inputs, [])
        self.assertEqual(case.env, {'VAR': 'foo'})
        self.assertEqual(self.build['tests'].tests, [case])
Exemplo n.º 5
0
 def make_extras(self):
     test_exe = file_types.Executable(self.Path('test'), None)
     test_exe.creator = 'creator'
     self.builtin_dict['test']([test_exe, '--foo'],
                               environment={
                                   'VAR': 'value'
                               })
     return test_exe
Exemplo n.º 6
0
 def test_invalid(self):
     prog = file_types.Executable(Path('prog'), None)
     driver = self.context['test_driver'](prog)
     with self.assertRaises(TypeError):
         self.context['test'](prog,
                              driver=driver,
                              environment={
                                  'VAR': 'foo'
                              })
Exemplo n.º 7
0
    def test_creator(self):
        prog = file_types.Executable(Path('prog'), None)
        prog.creator = 'creator'
        case = self.context['test'](prog)

        self.assertEqual(case.cmd, [prog])
        self.assertEqual(case.inputs, [prog])
        self.assertEqual(case.env, {})
        self.assertEqual(self.build['tests'].tests, [case])
Exemplo n.º 8
0
 def test_invalid(self):
     prog = file_types.Executable(Path('prog'), None)
     parent = self.builtin_dict['test_driver'](prog)
     with self.assertRaises(TypeError):
         self.builtin_dict['test_driver'](prog,
                                          parent=parent,
                                          environment={
                                              'VAR': 'foo'
                                          })
Exemplo n.º 9
0
    def test_basic(self):
        prog = file_types.Executable(Path('prog'), None)
        driver = self.context['test_driver'](prog)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [])
        self.assertEqual(driver.env, {})
        self.assertEqual(driver.tests, [])
        self.assertEqual(driver.wrap_children, False)
        self.assertEqual(self.build['tests'].tests, [driver])
Exemplo n.º 10
0
    def test_driver(self):
        prog = file_types.Executable(Path('prog'), None)
        driver = self.context['test_driver'](prog)
        case = self.context['test'](prog, driver=driver)

        self.assertEqual(case.cmd, [prog])
        self.assertEqual(case.inputs, [])
        self.assertEqual(case.env, {})
        self.assertEqual(self.build['tests'].tests, [driver])
        self.assertEqual(driver.tests, [case])
Exemplo n.º 11
0
    def test_environment(self):
        prog = file_types.Executable(Path('prog'), None)
        driver = self.context['test_driver'](prog, environment={'VAR': 'foo'})
        case = self.context['test'](prog, driver=driver)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [])
        self.assertEqual(driver.env, {'VAR': 'foo'})
        self.assertEqual(driver.tests, [case])
        self.assertEqual(driver.wrap_children, False)
        self.assertEqual(self.build['tests'].tests, [driver])
Exemplo n.º 12
0
    def test_case(self):
        prog = file_types.Executable(Path('prog'), None)
        driver = self.builtin_dict['test_driver'](prog)
        case = self.builtin_dict['test'](prog, driver=driver)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [])
        self.assertEqual(driver.env, {})
        self.assertEqual(driver.tests, [case])
        self.assertEqual(driver.wrap_children, False)
        self.assertEqual(self.build['tests'].tests, [driver])
Exemplo n.º 13
0
    def test_wrap_children(self):
        prog = file_types.Executable(Path('prog'), None)
        driver = self.context['test_driver'](prog, wrap_children=True)
        case = self.context['test'](prog, driver=driver)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [])
        self.assertEqual(driver.env, {})
        self.assertEqual(driver.tests, [case])
        self.assertEqual(driver.wrap_children, True)
        self.assertEqual(self.build['tests'].tests, [driver])
Exemplo n.º 14
0
    def test_creator(self):
        prog = file_types.Executable(Path('prog'), None)
        prog.creator = 'creator'
        driver = self.context['test_driver'](prog)
        case = self.context['test'](prog, driver=driver)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [prog])
        self.assertEqual(driver.env, {})
        self.assertEqual(driver.tests, [case])
        self.assertEqual(driver.wrap_children, False)
        self.assertEqual(self.build['tests'].tests, [driver])
Exemplo n.º 15
0
    def make_complex(self):
        test_exe = file_types.Executable(self.Path('test'), None)
        test_exe.creator = 'creator'
        self.builtin_dict['test'](test_exe)

        driver_exe = file_types.Executable(self.Path('driver'), None)
        driver = self.builtin_dict['test_driver'](driver_exe)

        mid_driver_exe = file_types.Executable(self.Path('mid_driver'), None)
        mid_driver = self.builtin_dict['test_driver'](mid_driver_exe,
                                                      parent=driver)
        mid_test_exe = file_types.Executable(self.Path('mid_test'), None)
        mid_test_exe.creator = 'creator'
        self.builtin_dict['test'](mid_test_exe, driver=mid_driver)

        inner_driver_exe = file_types.Executable(self.Path('inner_driver'),
                                                 None)
        inner_driver = self.builtin_dict['test_driver'](inner_driver_exe,
                                                        parent=mid_driver)
        inner_test_exe = file_types.Executable(self.Path('inner_test'), None)
        inner_test_exe.creator = 'creator'
        self.builtin_dict['test']([inner_test_exe, '--foo'],
                                  driver=inner_driver)

        return (test_exe, driver_exe, mid_driver_exe, mid_test_exe,
                inner_driver_exe, inner_test_exe)
Exemplo n.º 16
0
    def test_parent(self):
        prog = file_types.Executable(Path('prog'), None)
        parent = self.context['test_driver'](prog)
        driver = self.context['test_driver'](prog, parent=parent)
        case = self.context['test'](prog, driver=driver)

        self.assertEqual(driver.cmd, [prog])
        self.assertEqual(driver.inputs, [])
        self.assertEqual(driver.env, {})
        self.assertEqual(driver.tests, [case])
        self.assertEqual(driver.wrap_children, False)
        self.assertEqual(self.build['tests'].tests, [parent])
        self.assertEqual(parent.tests, [driver])
Exemplo n.º 17
0
 def test_filled(self):
     prog = file_types.Executable(Path('prog'), None)
     self.context['test'](prog)
     self.assertEqual(bool(self.build['tests']), True)
Exemplo n.º 18
0
 def make_empty_driver(self):
     driver_exe = file_types.Executable(self.Path('driver'), None)
     self.context['test_driver'](driver_exe)
     return driver_exe
Exemplo n.º 19
0
 def make_basic(self):
     test_exe = file_types.Executable(self.Path('test'), None)
     self.context['test'](test_exe)
     return test_exe
Exemplo n.º 20
0
 def test_multiple(self):
     foo = file_types.Executable(Path('foo'), None)
     bar = file_types.Executable(Path('bar'), None)
     self.context['test_deps'](foo, bar)
     self.assertEqual(self.build['tests'].extra_deps, [foo, bar])
Exemplo n.º 21
0
 def test_single(self):
     prog = file_types.Executable(Path('prog'), None)
     self.context['test_deps'](prog)
     self.assertEqual(self.build['tests'].extra_deps, [prog])