def get_manager_with_tests(test_names): port = Mock() # FIXME: Use a tighter mock. port.TEST_PATH_SEPARATOR = '/' manager = Manager(port, options=MockOptions(http=True), printer=Mock()) manager._test_files = set(test_names) manager._test_files_list = test_names return manager
def test_interrupt_if_at_failure_limits(self): port = Mock() # FIXME: This should be a tighter mock. port.TEST_PATH_SEPARATOR = '/' port._filesystem = MockFileSystem() manager = Manager(port=port, options=MockOptions(), printer=Mock()) manager._options = MockOptions(exit_after_n_failures=None, exit_after_n_crashes_or_timeouts=None) result_summary = ResultSummary(expectations=Mock(), test_files=[]) result_summary.unexpected_failures = 100 result_summary.unexpected_crashes = 50 result_summary.unexpected_timeouts = 50 # No exception when the exit_after* options are None. manager._interrupt_if_at_failure_limits(result_summary) # No exception when we haven't hit the limit yet. manager._options.exit_after_n_failures = 101 manager._options.exit_after_n_crashes_or_timeouts = 101 manager._interrupt_if_at_failure_limits(result_summary) # Interrupt if we've exceeded either limit: manager._options.exit_after_n_crashes_or_timeouts = 10 self.assertRaises(TestRunInterruptedException, manager._interrupt_if_at_failure_limits, result_summary) manager._options.exit_after_n_crashes_or_timeouts = None manager._options.exit_after_n_failures = 10 exception = self.assertRaises(TestRunInterruptedException, manager._interrupt_if_at_failure_limits, result_summary)
def get_manager(): port = Mock() # FIXME: Use a tighter mock. port.TEST_PATH_SEPARATOR = '/' manager = Manager(port, options=MockOptions(http=True, max_locked_shards=1), printer=Mock()) return manager
def get_manager(): port = Mock() # FIXME: Use a tighter mock. port.TEST_PATH_SEPARATOR = '/' port.web_platform_test_server_doc_root = get_wpt_doc_root manager = Manager(port, options=MockOptions(http=True), printer=Mock()) return manager
def get_manager_with_tests(test_names): port = Mock() # FIXME: Use a tighter mock. port.TEST_PATH_SEPARATOR = '/' manager = Manager(port, options=MockOptions(http=True, max_locked_shards=1), printer=Mock()) manager._test_names = test_names return manager