def test_search_dirs_fail(self): def mock_bad_execute(*args, **kwargs): raise OSError() with mock.patch('bfg9000.shell.execute', mock_bad_execute): ld = LdLinker(None, self.env, ['ld'], 'version') self.assertEqual(ld.search_dirs(), []) self.assertRaises(OSError, lambda: ld.search_dirs(strict=True))
def test_search_dirs_sysroot(self): with mock.patch('bfg9000.shell.execute', mock_execute): ld = LdLinker(None, self.env, ['ld'], 'version') self.assertEqual(ld.search_dirs(sysroot='/sysroot'), [abspath('/dir1'), abspath('/sysroot/dir2')])
def test_search_dirs(self): with mock.patch('bfg9000.shell.execute', mock_execute): ld = LdLinker(None, self.env, ['ld'], 'version') self.assertEqual(ld.search_dirs(), ['/dir1', '/dir2'])