openstack-python-openstackc.../openstackclient/tests/unit
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
..
api Merge "Rename review.openstack.org to review.opendev.org" 2019-06-14 02:25:02 +00:00
common Use SDK to get compute API extensions 2019-10-31 16:48:29 +00:00
compute Provide stderr in exception when check_parser fails 2019-11-20 13:39:40 +00:00
identity Add parent project filter for listing projects 2019-09-02 09:05:37 +09:00
image Use cliff formattable columns in image commands 2019-06-22 13:36:46 -05:00
integ Make configuration show not require auth 2019-08-01 14:53:02 -05:00
network Merge "Add floating IP Port Forwarding commands" 2019-09-09 16:12:23 +00:00
object Before writing object data to stdout, re-open it in binary mode 2019-04-10 14:34:40 -05:00
volume Merge "Use cliff formattable columns in volume v2 commands" 2019-06-23 00:45:37 +00:00
__init__.py move unit tests to new "unit" test module 2016-09-08 15:19:50 -07:00
fakes.py Adding api_version to FakeApp 2018-06-24 03:47:23 +00:00
test_shell.py Remove token_endpoint auth type 2019-08-27 11:08:50 -05:00
utils.py Provide stderr in exception when check_parser fails 2019-11-20 13:39:40 +00:00