Matt Riedemann 5b3a827a1f Provide stderr in exception when check_parser fails
For negative tests that are asserting an argparse failure
it would be useful to assert the specific reason for the
failure in the test rather than just getting an exception,
especially to avoid false positives in the tests when what
is being tested and failing isn't the actual expected reason
for the failure.

This wraps the check_parser code that parses the args and
mocks sys.stderr so we can trap that output and put it in the
exception message that gets raised to the test.

As a result, we can tighten up a test that was passing before
for the wrong reason [1].

[1] https://review.opendev.org/#/c/673725/12/openstackclient/tests/unit/compute/v2/test_server.py@605

Change-Id: I0f1dc1215bdfb3eba98ccaf66a0041d220b93812
2019-11-20 13:39:40 +00:00
..
2019-08-27 11:08:50 -05:00
2019-11-05 07:09:05 -06:00
2019-11-01 14:24:30 -05:00
2019-11-01 14:24:30 -05:00
2019-09-09 09:35:44 -05:00
2018-04-15 12:23:06 +09:00
2017-03-21 17:23:09 +08:00