def test_merge_lines(self): command = flakytests.FlakyTests() factory = FakeBotTestExpectationsFactory() old_builders = builders._exact_matches builders._exact_matches = { "foo-builder": { "port_name": "dummy-port", "specifiers": ['Linux', 'Release'] }, "bar-builder": { "port_name": "dummy-port", "specifiers": ['Mac', 'Debug'] }, } try: lines = command._collect_expectation_lines( ['foo-builder', 'bar-builder'], factory) self.assertEqual(len(lines), 1) self.assertEqual(lines[0].expectations, ['TEXT', 'TIMEOUT', 'PASS']) self.assertEqual(lines[0].specifiers, ['Mac', 'Linux']) finally: builders._exact_matches = old_builders
def test_integration_uploads(self): command = flakytests.FlakyTests() tool = MockTool() tool.scm = ChangedExpectationsMockSCM command.expectations_factory = FakeBotTestExpectationsFactory reviewer = '*****@*****.**' options = MockOptions(upload=True, reviewers=reviewer) expected_stdout = """Updated /mock-checkout/third_party/WebKit/LayoutTests/FlakyTests """ self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout) self.assertEqual(tool.executive.calls, [ [ 'git', 'commit', '-m', command.COMMIT_MESSAGE % reviewer, '/mock-checkout/third_party/WebKit/LayoutTests/FlakyTests' ], [ 'git', 'cl', 'upload', '--send-mail', '-f', '--cc', '[email protected],[email protected],[email protected]' ], ]) port = tool.port_factory.get() self.assertEqual( tool.filesystem.read_text_file( tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
def test_merge_lines(self): command = flakytests.FlakyTests() factory = FakeBotTestExpectationsFactory(FakeBuilders()) lines = command._collect_expectation_lines( ['foo-builder', 'bar-builder'], factory) self.assertEqual(len(lines), 1) self.assertEqual(lines[0].expectations, ['TEXT', 'TIMEOUT', 'PASS']) self.assertEqual(lines[0].specifiers, ['Mac', 'Linux'])
def test_integration(self): command = flakytests.FlakyTests() tool = MockTool() command.expectations_factory = FakeBotTestExpectationsFactory options = MockOptions(upload=True) expected_stdout = """Updated /mock-checkout/third_party/WebKit/tests/FlakyTests tests/FlakyTests is not changed, not uploading. """ self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout) port = tool.port_factory.get() self.assertEqual(tool.filesystem.read_text_file(tool.filesystem.join(port.layout_tests_dir(), 'FlakyTests')), command.FLAKY_TEST_CONTENTS % '')
def test_integration(self): command = flakytests.FlakyTests() tool = MockTool() command.expectations_factory = FakeBotTestExpectationsFactory options = MockOptions(upload=True) expected_stdout = flakytests.FlakyTests.OUTPUT % ( flakytests.FlakyTests.HEADER, '', flakytests.FlakyTests.FLAKINESS_DASHBOARD_URL % '') + '\n' self.assert_execute_outputs(command, options=options, tool=tool, expected_stdout=expected_stdout)
def test_simple(self): command = flakytests.FlakyTests() factory = FakeBotTestExpectationsFactory() lines = command._collect_expectation_lines(['foo'], factory) self.assertEqual(lines, [])