def __init__(self, *args, **kwargs): MockHost.__init__(self, *args, **kwargs) self._deprecated_port = MockPort() self.status_server = MockStatusServer() self.wakeup_event = threading.Event()
def __init__(self, *args, **kwargs): MockHost.__init__(self, *args, **kwargs) self._deprecated_port = MockPort() self.status_server = MockStatusServer() self._irc = None self.irc_password = "******" self.wakeup_event = threading.Event()
def __init__(self, *args, **kwargs): MockHost.__init__(self, *args, **kwargs) self._port = TestPort(self) self._port.name = lambda: "MockPort" self.status_server = MockStatusServer() self._irc = None self.irc_password = "******" self.wakeup_event = threading.Event()
def test_report_flaky_tests_creating_bug(self): tool = MockTool() tool.filesystem = MockFileSystem( {"/mock-results/foo/bar-diffs.txt": "mock"}) tool.status_server = MockStatusServer(bot_id="mock-bot-id") reporter = FlakyTestReporter(tool, 'dummy-queue') reporter._lookup_bug_for_flaky_test = lambda bug_id: None patch = tool.bugs.fetch_attachment(10000) expected_logs = """Bug does not already exist for foo/bar.html, creating. MOCK create_bug bug_title: Flaky Test: foo/bar.html bug_description: This is an automatically generated bug from the dummy-queue. foo/bar.html has been flaky on the dummy-queue. foo/bar.html was authored by [email protected]. http://trac.webkit.org/browser/trunk/LayoutTests/foo/bar.html The dummy-queue just saw foo/bar.html flake (text diff) while processing attachment 10000 on bug 50000. Bot: mock-bot-id Port: MockPort Platform: MockPlatform 1.0 The bots will update this with information from each new failure. If you believe this bug to be fixed or invalid, feel free to close. The bots will re-open if the flake re-occurs. If you would like to track this test fix with another bug, please close this bug as a duplicate. The bots will follow the duplicate chain when making future comments. component: Tools / Tests cc: [email protected] blocked: 50856 MOCK add_attachment_to_bug: bug_id=60001, description=Failure diff from mock-bot-id filename=failure.diff mimetype=None MOCK bug comment: bug_id=50000, cc=None --- Begin comment --- The dummy-queue encountered the following flaky tests while processing attachment 10000: foo/bar.html bug 60001 (author: [email protected]) The dummy-queue is continuing to process your patch. --- End comment --- """ test_results = [self._mock_test_result('foo/bar.html')] class MockZipFile(object): def read(self, path): return "" def namelist(self): return ['foo/bar-diffs.txt'] OutputCapture().assert_outputs( self, reporter.report_flaky_tests, [patch, test_results, MockZipFile()], expected_logs=expected_logs)
def test_next_patch(self): queue = AbstractPatchQueue() tool = MockTool() queue.bind_to_tool(tool) queue._options = Mock() queue._options.port = None self.assertEquals(queue._next_patch(), None) tool.status_server = MockStatusServer(work_items=[2, 10000]) expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes. expected_stderr = "MOCK: release_work_item: None 2\n" patch_id = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_stderr=expected_stderr) self.assertEquals(patch_id, None) # 2 is an invalid patch id self.assertEquals(queue._next_patch().id(), 10000)
def test_next_patch(self): queue = AbstractPatchQueue() tool = MockTool() queue.bind_to_tool(tool) queue._options = Mock() queue._options.port = None self.assertIsNone(queue._next_patch()) tool.status_server = MockStatusServer(work_items=[2, 10000, 10001]) expected_stdout = "MOCK: fetch_attachment: 2 is not a known attachment id\n" # A mock-only message to prevent us from making mistakes. expected_logs = "MOCK: release_work_item: None 2\n" patch = OutputCapture().assert_outputs(self, queue._next_patch, expected_stdout=expected_stdout, expected_logs=expected_logs) # The patch.id() == 2 is ignored because it doesn't exist. self.assertEqual(patch.id(), 10000) self.assertEqual(queue._next_patch().id(), 10001) self.assertEqual(queue._next_patch(), None) # When the queue is empty
def __init__(self): self.status_server = MockStatusServer()
def test_summary_text(self): tool = MockTool() tool.status_server = MockStatusServer("MockBotId") self.assertEqual( BotInfo(tool).summary_text(), "Bot: MockBotId Port: MockPort Platform: MockPlatform 1.0")