From e6df8cbe240d880d89f142d559ca385580115113 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Sun, 12 Jul 2015 12:27:26 +0100 Subject: [PATCH] Add allowed choices to output format. Since we're using the print function, we can specify the file handler to user and in this case we choose `sys.stderr` --- tests/modparser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/modparser.py b/tests/modparser.py index 767f20e8654..9ac0bb1f305 100644 --- a/tests/modparser.py +++ b/tests/modparser.py @@ -36,6 +36,7 @@ def parse(): '-f', '--format', dest='format', + choices=('pprint', 'yaml'), default='pprint') out = parser.parse_args() return out.__dict__ @@ -49,7 +50,7 @@ def mod_data(opts, full): try: finder.load_file(full) except ImportError: - sys.stderr.write('ImportError - {0}\n'.format(full)) + print('ImportError - {0}'.format(full), file=sys.stderr) return ret for name, mod in finder.modules.items(): basemod = name.split('.')[0]