示例#1
0
文件: talk.py 项目: zlandau/hhvm
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--request_timeout",
        type=int,
        action="store",
        default=30,
        help="duration to wait for request responses, in seconds.",
    )
    parser.add_argument(
        "--notify_timeout",
        type=int,
        action="store",
        default=1,
        help="duration to wait for notify responses, in seconds.",
    )
    parser.add_argument(
        "--verbose",
        action="store_true",
        default=False,
        help="display diagnostic information while reading/writing.",
    )
    parser.add_argument(
        "--silent",
        action="store_true",
        default=False,
        help="suppresses printing of transcript, but not diagnostics.",
    )
    parser.add_argument(
        "files",
        metavar="FILE",
        nargs="*",
        default=["-"],
        help="list of files to read, if empty, stdin is used.",
    )
    args = parser.parse_args()

    commands = LspCommandProcessor.parse_commands(read_commands(args.files))

    with LspCommandProcessor.create() as lsp_proc:
        transcript = lsp_proc.communicate(
            commands,
            request_timeout=args.request_timeout,
            notify_timeout=args.notify_timeout,
            verbose=args.verbose,
        )
        if not args.silent:
            print_transcript(lsp_proc, transcript)
示例#2
0
    def run_lsp_test(self, test_name, test, expected, generate):
        commands = LspCommandProcessor.parse_commands(test)
        with LspCommandProcessor.create(self.test_env) as lsp:
            observed_transcript = lsp.communicate(commands)

        if not generate:
            expected_items = self.prepare_responses(json.loads(expected))
            observed_items = self.prepare_responses(
                self.get_received_items(observed_transcript))

            # validation checks that the number of items matches and that
            # the responses are exactly identical to what we expect
            self.assertEqual(len(expected_items), len(observed_items))
            for i in range(len(expected_items)):
                self.assertEqual(observed_items[i], expected_items[i])
        else:
            self.generate_expected(test_name, observed_transcript)
示例#3
0
文件: talk.py 项目: zxy787956151/hpvm
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--request_timeout',
        type=int,
        action='store',
        default=30,
        help='duration to wait for request responses, in seconds.')
    parser.add_argument(
        '--notify_timeout',
        type=int,
        action='store',
        default=1,
        help='duration to wait for notify responses, in seconds.')
    parser.add_argument(
        '--verbose',
        action='store_true',
        default=False,
        help='display diagnostic information while reading/writing.')
    parser.add_argument(
        '--silent',
        action='store_true',
        default=False,
        help='suppresses printing of transcript, but not diagnostics.')
    parser.add_argument('files',
                        metavar='FILE',
                        nargs='*',
                        default=['-'],
                        help='list of files to read, if empty, stdin is used.')
    args = parser.parse_args()

    commands = LspCommandProcessor.parse_commands(read_commands(args.files))

    with LspCommandProcessor.create() as lsp_proc:
        transcript = lsp_proc.communicate(commands,
                                          request_timeout=args.request_timeout,
                                          notify_timeout=args.notify_timeout,
                                          verbose=args.verbose)
        if not args.silent:
            print_transcript(lsp_proc, transcript)
示例#4
0
文件: talk.py 项目: SiebelsTim/hhvm
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('--request_timeout',
                        type=int,
                        action='store',
                        default=30,
                        help='duration to wait for request responses, in seconds.')
    parser.add_argument('--notify_timeout',
                        type=int,
                        action='store',
                        default=1,
                        help='duration to wait for notify responses, in seconds.')
    parser.add_argument('--verbose',
                        action='store_true',
                        default=False,
                        help='display diagnostic information while reading/writing.')
    parser.add_argument('--silent',
                        action='store_true',
                        default=False,
                        help='suppresses printing of transcript, but not diagnostics.')
    parser.add_argument('files',
                        metavar='FILE',
                        nargs='*',
                        default=['-'],
                        help='list of files to read, if empty, stdin is used.')
    args = parser.parse_args()

    commands = LspCommandProcessor.parse_commands(read_commands(args.files))

    with LspCommandProcessor.create() as lsp_proc:
        transcript = lsp_proc.communicate(commands,
                                          request_timeout=args.request_timeout,
                                          notify_timeout=args.notify_timeout,
                                          verbose=args.verbose)
        if not args.silent:
            print_transcript(lsp_proc, transcript)