예제 #1
0
 def test_cant_install(self):
     with mock.patch('bfg9000.builtins.install.can_install',
                     return_value=False), \
          mock.patch('warnings.warn') as m:  # noqa
         exe = Executable(Path('exe', Root.srcdir), None)
         installed = Executable(Path('exe', InstallRoot.bindir), None)
         self.assertEqual(self.context['install'](exe), installed)
         self.assertEqual(m.call_count, 1)
예제 #2
0
 def test_install_add_to_default(self):
     exe = Executable(Path('exe', Root.srcdir), None)
     exe.creator = 'creator'
     installed = Executable(Path('exe', InstallRoot.bindir), None)
     self.assertEqual(self.context['install'](exe), installed)
     self.assertEqual(self.build['install'].explicit, [exe])
     self.assertEqual(self.build['install'].implicit, [exe])
     self.assertEqual(self.build['defaults'].outputs, [exe])
예제 #3
0
 def test_install_nested_multiple(self):
     exe1 = Executable(Path('exe1', Root.srcdir), None)
     exe2 = Executable(Path('exe2', Root.srcdir), None)
     installed1 = Executable(Path('exe1', InstallRoot.bindir), None)
     installed2 = Executable(Path('exe2', InstallRoot.bindir), None)
     self.assertEqual(self.context['install'](exe1, [exe2], None),
                      (installed1, [installed2], None))
     self.assertEqual(self.build['install'].explicit, [exe1, exe2])
     self.assertEqual(self.build['install'].implicit, [exe1, exe2])
예제 #4
0
    def test_run_arguments_executable(self):
        exe = Executable(self.Path('file', Root.srcdir), 'jvm', lang=self.lang)
        self.assertEqual(self.runner.run_arguments(exe),
                         [self.runner] + self.jar_args + [exe])

        with mock.patch('bfg9000.shell.which', return_value=['command']), \
             mock.patch('bfg9000.shell.execute', default_mock_execute):
            args = self.env.run_arguments(exe)
        self.assertEqual(len(args), len(self.jar_args) + 2)
        self.assertEqual(type(args[0]), JvmRunner)
        self.assertEqual(args[1:], self.jar_args + [exe])
예제 #5
0
    def test_invalid(self):
        phony = Phony('name')
        self.assertRaises(TypeError, self.context['install'], phony)

        exe = Executable(Path('/path/to/exe', Root.absolute), None)
        self.assertRaises(ValueError, self.context['install'], exe)
예제 #6
0
 def test_install_single(self):
     exe = Executable(Path('exe', Root.srcdir), None)
     installed = Executable(Path('exe', InstallRoot.bindir), None)
     self.assertEqual(self.context['install'](exe), installed)
     self.assertEqual(self.build['install'].explicit, [exe])
     self.assertEqual(self.build['install'].implicit, [exe])