コード例 #1
0
ファイル: workspace_unittest.py プロジェクト: subhanshuja/ofa
    def test_create_zip_exception(self):
        workspace = Workspace(
            None, MockExecutive(should_log=True, should_throw=True))
        expected_logs = """MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path
Workspace.create_zip failed in /source/path:
MOCK ScriptError

output: MOCK output of child process
"""

        class MockZipFile(object):
            def __init__(self, path):
                self.filename = path

        archive = OutputCapture().assert_outputs(
            self,
            workspace.create_zip, ["/zip/path", "/source/path", MockZipFile],
            expected_logs=expected_logs)
        self.assertIsNone(archive)
コード例 #2
0
ファイル: workspace_unittest.py プロジェクト: eocanha/webkit
    def test_create_zip_exception(self):
        workspace = Workspace(
            None, MockExecutive(should_log=True, should_throw=True))

        class MockZipFile(object):
            def __init__(self, path):
                self.filename = path

        with OutputCapture(level=logging.INFO) as captured:
            archive = workspace.create_zip('/zip/path', '/source/path',
                                           MockZipFile)
        self.assertEqual(
            captured.root.log.getvalue(),
            '''MOCK run_command: ['zip', '-9', '-r', '/zip/path', '.'], cwd=/source/path
Workspace.create_zip failed in /source/path:
MOCK ScriptError

MOCK output of child process
''',
        )

        self.assertIsNone(archive)