OutputWrapper class to Commands which outputs to stream object of choice

Review Request #11401 — Created Jan. 23, 2021 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

RBTools commands were previously using print and sys.stderr
to output messages. This change abstracting outputting by using a
wrapper around a stream output object. This makes it easier to customize
output streams and suppress output. 4 wrappers (2 for standard output
unicode and byte, 2 for standard error unicode and byte) are initiated
in the Command class that is accessible to all child classes.

Ran all tests in ./tests/runtests.py rbtools.commands and passed.

Added two new tests for __init__.py. One that tests if output stream
object is set correctly for OutputWrapper and another test that makes
sure OutputWrapper passes the correct message to the output stream object

Diff Revision 15

This is not the most recent revision of the diff. The latest diff is revision 16. See what's changed.

orig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Commits

First Last Summary ID Author
merged in Output Wrapper Object from r#11401
fc3442b40f7688eae2dc8943c3905de1189aba49 Ryan Kang
added new method to print JSON to stream object and tests to ensure it works ...
93a7f52f930aec3fe39c3d0d9c0f15ee4a14922c Ryan Kang
added new global command --json
8d6ea988b098794628c133cbbcd42f524293d873 Ryan Kang
added conditional at the end of command cycle to print JSON is enabled
312b2d649dc71fa01637c427209d5f972c193402 Ryan Kang
added method to append to classes and tests to ensure items are appended corr...
9ecb2ddb435c1889c5b000d2ad2d57f7bc3f04b8 Ryan Kang
added new method to add errors to existing errors key or create a new one
99df72a53c52f7b839decff237fa694d19baa190 Ryan Kang
Fixed issues with extra white spaces in files from Review Bot
505c93c8f2a525fc8a8114e37b69ccdf4f283b9d Ryan Kang
Added docstrings to JSONOutput class and changed name from JSONWrapper to JSO...
Improved command hint for --json Fixed header in test_main to import kgb and concatonated imports from rbtools.commands Created _setup() method in JSONOutputTests test class to standardize JSONOutput initialization
1c4e3367bd82af470f4889056c35e1e137b9d9ff Ryan Kang
Fixed minor formatting issues in test_main.py
c110d05aca25324d53b55ed678169610aa9a7c07 Ryan Kang
Updated JSONOutput docstrings to format with guidelines
d58d4e8f8bbe7b1c4486479d2d4ebc25cb545010 Ryan Kang
Updated docstrings in JSONOutputTests in test_main.py to comply with guidelines
29daf66756b65033e122b5cb2466e588ad4a7635 Ryan Kang
Checking if there are any errors in json to decide status
a0ee53dabe7e1c7894412281719b38db1410f16f Ryan Kang
Fixed trailing white space in test_main.test_hson_wrapper_append
40c9ab291084fd36bed86e74761ed579706a612c Ryan Kang
Fixed blank lines with spaces in __init__ Command.run_from_argv
fe0dd7c90d293e3885890f4ca3be0dafe506a63a Ryan Kang
Added any CommandError caught to errors key
b662b573e9452277ea177d990b2f8d750028f2f2 Ryan Kang
Fixed bug where test_main.py was imported JSONWrapper instead of JSONOutput
412f531a218f3c9bf2eac16ebb765ef74d0bcb30 Ryan Kang
rbtools/commands/__init__.py
rbtools/commands/tests/test_main.py
Loading...