Currently, we've got the warn and fail functions (which both call warn_or_fail behind the scenes). The latter will print to stdout and sys.exit(-1). IMO, this is a bad design. If the Argument Clinic tool exits with an error, we should print to stderr, as every well-behaved command line tool should do.
If we rewrote so fail raises a ClinicError exception and warn uses warnings.warn, we could...:
rework if __name__ == __main__ to catch ClinicError, print to stderr and exit
we could use assertRaisesRegex in the test suite (major simplification of the test code)
Currently, we've got the
warn
andfail
functions (which both callwarn_or_fail
behind the scenes). The latter will print to stdout andsys.exit(-1)
. IMO, this is a bad design. If the Argument Clinic tool exits with an error, we should print to stderr, as every well-behaved command line tool should do.If we rewrote so
fail
raises a ClinicError exception andwarn
useswarnings.warn
, we could...:if __name__ == __main__
to catch ClinicError, print to stderr and exitassertRaisesRegex
in the test suite (major simplification of the test code)