From a93d0ed25c8a6b36adaacd10c205877b62cda4d5 Mon Sep 17 00:00:00 2001 From: Eric Snow Date: Thu, 11 Jan 2018 18:36:14 +0000 Subject: [PATCH] Print progress messages during download. --- debugger_protocol/schema/__main__.py | 8 ++++++-- tests/debugger_protocol/schema/test___main__.py | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/debugger_protocol/schema/__main__.py b/debugger_protocol/schema/__main__.py index fb9817a6..74908227 100644 --- a/debugger_protocol/schema/__main__.py +++ b/debugger_protocol/schema/__main__.py @@ -21,17 +21,21 @@ def as_command(name): def handle_download(source=UPSTREAM, target=VENDORED, *, _open=open, _open_url=open_url): # Download the schema file. + print('downloading the schema file from {}...'.format(source)) with _open_url(source) as infile: with _open(target, 'wb') as outfile: meta = download(source, infile, outfile, _open_url=_open_url) + print('...schema file written to {}.'.format(target)) # Save the metadata. - metafile, _ = open_metadata(target, 'w', - _open=_open) + print('saving the schema metadata...') + metafile, filename = open_metadata(target, 'w', + _open=_open) with metafile: metafile.write( meta.format()) + print('...metadata written to {}.'.format(filename)) @as_command('check') diff --git a/tests/debugger_protocol/schema/test___main__.py b/tests/debugger_protocol/schema/test___main__.py index 9238c0ff..a044403e 100644 --- a/tests/debugger_protocol/schema/test___main__.py +++ b/tests/debugger_protocol/schema/test___main__.py @@ -4,6 +4,7 @@ from textwrap import dedent import unittest from .helpers import StubOpener +from debugger_protocol.schema.vendored import FILENAME as VENDORED, METADATA from debugger_protocol.schema.__main__ import ( COMMANDS, handle_download, handle_check) @@ -58,7 +59,12 @@ class HandleDownloadTests(unittest.TestCase): revision: fc2395ca3564fb2afded8d90ddbe38dad1bf86f1 checksum: e778c3751f9d0bceaf8d5aa81e2c659f """).strip()) # noqa - self.assertEqual(stdout.getvalue(), '') + self.assertEqual(stdout.getvalue(), dedent("""\ + downloading the schema file from https://github.com/Microsoft/vscode-debugadapter-node/raw/master/debugProtocol.json... + ...schema file written to {}. + saving the schema metadata... + ...metadata written to {}. + """).format(VENDORED, METADATA)) # noqa class HandleCheckTests(unittest.TestCase):