def test_after_testrun_ok(self): plugin = RichCorePlugin( TestRunData(Options(), config=_build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) print plugin.result_dir print plugin.process_rich_core_dumps global g_Command g_Command = Stub_Command("test", 0, "build_id") plugin._execute_ssh_command = _stub_execute_ssh_command def _stub_subprocess_call(cmdstr, shell=True): pass subprocess.call = _stub_subprocess_call path = os.path.join(TEST_RESULT_DIR, "testdef", "results", TEST_FILE) try: temp = open(path, "w") temp.write("foo") temp.close() except IOError: return plugin.after_testrun() self.assertFalse(os.path.exists(path))
def test_after_testrun_ok(self): plugin = RichCorePlugin(TestRunData(Options(), config = _build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) print plugin.result_dir print plugin.process_rich_core_dumps global g_Command g_Command = Stub_Command("test", 0, "build_id") plugin._execute_ssh_command = _stub_execute_ssh_command def _stub_subprocess_call(cmdstr, shell=True): pass subprocess.call = _stub_subprocess_call path = os.path.join(TEST_RESULT_DIR, "testdef", "results", TEST_FILE) try: temp = open(path, "w") temp.write("foo") temp.close() except IOError: return plugin.after_testrun() self.assertFalse(os.path.exists(path))
def test_before_testrun_fetching_build_id_failed(self): plugin = RichCorePlugin( TestRunData(Options(), config=_build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) global g_Command g_Command = Stub_Command("test", 1, "foo") plugin._execute_ssh_command = _stub_execute_ssh_command plugin.before_testrun() self.assertFalse(plugin.process_rich_core_dumps)
def test_before_testrun_disabled(self): config = _build_conductor_config() del config['rich_core_dumps_folder'] plugin = RichCorePlugin(TestRunData(Options(), config)) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) plugin.before_testrun() self.assertFalse(plugin.process_rich_core_dumps)
def test_before_testrun_fetching_build_id_failed(self): plugin = RichCorePlugin(TestRunData(Options(), config = _build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) global g_Command g_Command = Stub_Command("test", 1, "foo") plugin._execute_ssh_command = _stub_execute_ssh_command plugin.before_testrun() self.assertFalse(plugin.process_rich_core_dumps)
def test_before_testrun_ok(self): plugin = RichCorePlugin( TestRunData(Options(), config=_build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) global g_Command g_Command = Stub_Command("test", 0, "build_id") plugin._execute_ssh_command = _stub_execute_ssh_command def _stub_subprocess_call(cmdstr, shell=True): pass subprocess.call = _stub_subprocess_call plugin.before_testrun() self.assertTrue(plugin.process_rich_core_dumps)
def test_before_testrun_ok(self): plugin = RichCorePlugin(TestRunData(Options(), config = _build_conductor_config())) plugin.set_target(Stub_Target()) plugin.set_result_dir(TEST_RESULT_DIR) global g_Command g_Command = Stub_Command("test", 0, "build_id") plugin._execute_ssh_command = _stub_execute_ssh_command def _stub_subprocess_call(cmdstr, shell=True): pass subprocess.call = _stub_subprocess_call plugin.before_testrun() self.assertTrue(plugin.process_rich_core_dumps)