def test_import_dir_with_no_tests(self): host = MockHost() host.executive = MockExecutive2(exception=ScriptError("abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!")) host.filesystem = MockFileSystem(files=FAKE_FILES) importer = TestImporter(host, FAKE_SOURCE_DIR, optparse.Values({"overwrite": False, 'destination': 'w3c', 'test_paths': [FAKE_TEST_PATH]})) oc = OutputCapture() oc.capture_output() try: importer.do_import() finally: oc.restore_output()
def test_import_dir_with_no_tests(self): host = MockHost() host.executive = MockExecutive2(exception=ScriptError("abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!")) host.filesystem = MockFileSystem(files=FAKE_FILES) importer = TestImporter(host, FAKE_SOURCE_DIR, self._parse_options(['-n', '-d', 'w3c', '-t', FAKE_TEST_PATH])) oc = OutputCapture() oc.capture_output() try: importer.do_import() finally: oc.restore_output()
def test_import_dir_with_no_tests(self): FAKE_FILES.update(FAKE_REPOSITORIES) host = MockHost() host.executive = MockExecutive2(exception=ScriptError( "abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!" )) host.filesystem = MockFileSystem(files=FAKE_FILES) importer = TestImporter( host, FAKE_TEST_PATH, self._parse_options(['-n', '-d', 'w3c', '-s', FAKE_SOURCE_DIR])) with OutputCapture(): importer.do_import()
def test_import_dir_with_no_tests(self): # FIXME: Use MockHosts instead. host = Host() host.executive = MockExecutive2(exception=ScriptError("abort: no repository found in '/Volumes/Source/src/wk/Tools/Scripts/webkitpy/w3c' (.hg not found)!")) importer = TestImporter(host, None, optparse.Values({"overwrite": False})) importer.source_directory = importer.path_from_webkit_root("Tools", "Scripts", "webkitpy", "w3c") importer.destination_directory = tempfile.mkdtemp(prefix='csswg') oc = OutputCapture() oc.capture_output() try: importer.do_import() finally: oc.restore_output() shutil.rmtree(importer.destination_directory, ignore_errors=True)
def throwing_run_command(args): print(args) raise ScriptError("MOCK script error")
def throwing_run_command(args): if args[0] == '/usr/sbin/spindump': return 1 raise ScriptError('MOCK script error')
def throwing_run_command(args): if args[0] == '/usr/bin/sudo': return 1 raise ScriptError("MOCK script error")
def test_import_dir_with_no_tests(self): host = MockHost() host.executive = MockExecutive(exception=ScriptError('error')) host.filesystem = MockFileSystem(files=FAKE_FILES) copier = TestCopier(host, FAKE_SOURCE_REPO_DIR, 'destination') copier.do_import() # No exception raised.