def mock_host(self): """Returns a mock host with fake values set up for testing.""" host = MockHost() host.port_factory = MockPortFactory(host) # Set up a fake list of try builders. host.builders = BuilderList({ 'MOCK Try Mac10.10': { 'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Mac10.11': { 'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release'], 'is_try_builder': True, }, 'MOCK Try Trusty': { 'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release'], 'is_try_builder': True, }, 'MOCK Try Precise': { 'port_name': 'test-linux-precise', 'specifiers': ['Precise', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win10': { 'port_name': 'test-win-win10', 'specifiers': ['Win10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win7': { 'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release'], 'is_try_builder': True, }, }) # Write a dummy manifest file, describing what tests exist. host.filesystem.write_text_file( host.port_factory.get().layout_tests_dir() + '/external/wpt/MANIFEST.json', json.dumps({ 'items': { 'reftest': { 'reftest.html': [['/reftest.html', [['/reftest-ref.html', '==']], {}]] }, 'testharness': { 'test/path.html': [['/test/path.html', {}]], 'test/zzzz.html': [['/test/zzzz.html', {}]], }, 'manual': { 'x-manual.html': [['/x-manual.html', {}]], }, }, })) return host
def test_run_commit_queue_for_cl_only_checks_non_blink_bots(self): host = MockHost() host.filesystem.write_text_file( '/mock-checkout/third_party/WebKit/LayoutTests/W3CImportExpectations', '') host.builders = BuilderList({ 'fakeos_blink_rel': { 'port_name': 'test-fakeos', 'specifiers': ['FakeOS', 'Release'], 'is_try_builder': True, } }) importer = TestImporter(host) importer.git_cl = MockGitCL(host, results={ Build('fakeos_blink_rel', 123): TryJobStatus('COMPLETED', 'FAILURE'), Build('cq-builder-b', 200): TryJobStatus('COMPLETED', 'SUCCESS'), }) importer.fetch_new_expectations_and_baselines = lambda: None success = importer.run_commit_queue_for_cl() self.assertTrue(success) self.assertLog([ 'INFO: Triggering CQ try jobs.\n', 'INFO: CQ appears to have passed; trying to commit.\n', 'INFO: Update completed.\n', ]) self.assertEqual(importer.git_cl.calls, [ ['git', 'cl', 'try'], ['git', 'cl', 'upload', '-f', '--send-mail'], ['git', 'cl', 'set-commit'], ])
def mock_host(self): super(WPTExpectationsUpdaterTest, self).setUp() host = MockHost() host.port_factory = MockPortFactory(host) host.builders = BuilderList({ 'MOCK Try Mac10.10': { 'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Mac10.11': { 'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release'], 'is_try_builder': True, }, 'MOCK Try Trusty': { 'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release'], 'is_try_builder': True, }, 'MOCK Try Precise': { 'port_name': 'test-linux-precise', 'specifiers': ['Precise', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win10': { 'port_name': 'test-win-win10', 'specifiers': ['Win10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win7': { 'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release'], 'is_try_builder': True, }, }) host.filesystem.write_text_file( host.port_factory.get().layout_tests_dir() + '/external/wpt/MANIFEST.json', json.dumps({ 'items': { 'reftest': { 'reftest.html': [['/reftest.html', [['/reftest-ref.html', '==']], {}]] }, 'testharness': { 'test/path.html': [['/test/path.html', {}]], 'test/zzzz.html': [['/test/zzzz.html', {}]], }, 'manual': { 'x-manual.html': [['/x-manual.html', {}]], }, }, })) return host
def test_get_from_builder_name(self): host = MockHost() host.builders = BuilderList({ 'My Fake Mac10.12 Builder': { 'port_name': 'mac-mac10.12', 'specifiers': ['Mac10.12', 'Release'], } }) self.assertEqual( factory.PortFactory(host).get_from_builder_name( 'My Fake Mac10.12 Builder').name(), 'mac-mac10.12')
def mock_host(self): super(WPTExpectationsUpdaterTest, self).setUp() host = MockHost() host.port_factory = MockPortFactory(host) host.builders = BuilderList({ 'MOCK Try Mac10.10': { 'port_name': 'test-mac-mac10.10', 'specifiers': ['Mac10.10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Mac10.11': { 'port_name': 'test-mac-mac10.11', 'specifiers': ['Mac10.11', 'Release'], 'is_try_builder': True, }, 'MOCK Try Trusty': { 'port_name': 'test-linux-trusty', 'specifiers': ['Trusty', 'Release'], 'is_try_builder': True, }, 'MOCK Try Precise': { 'port_name': 'test-linux-precise', 'specifiers': ['Precise', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win10': { 'port_name': 'test-win-win10', 'specifiers': ['Win10', 'Release'], 'is_try_builder': True, }, 'MOCK Try Win7': { 'port_name': 'test-win-win7', 'specifiers': ['Win7', 'Release'], 'is_try_builder': True, }, }) return host