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

Changes between revision 15 and 16

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

Commits

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
added OutputWrapper class to Commands which outputs to stream object of choic...
ca88dd1ff65187e387fdf17dc19f4c0c89fb903c Ryan Kang
replaced all of the prints with output wrapper and initiated wrapper in Comma...
e31adcfce9cf6cdbc5272a57a81cb0c7acdd7c5b Ryan Kang
Fixed all of the Review Bot string formatting issues and fixed consistency is...
360b92a955667e881394ee9f8a482d397bf176e6 Ryan Kang
Fixed Review Bot issues on trailing white spaces, indentation, whitespace aft...
0e77eec5effa3e23f3d13fb7578f2ef22037f413 Ryan Kang
Added new test for OutputWrapper than ensures it passes a new line character ...
f137a9331459e3d88d9cb96f3e499730c6adcb30 Ryan Kang
Fixed inconsistency of the use of new_line(). Replaced self.stdout.write(n) w...
70cfb2c6f67be4b3f10af316835aae37488328e4 Ryan Kang
Fixed white space error at the end of rbtools/commands/__init__.py
91baf8a9e9f2e4d8c9b30a19c76d72b0860849b9 Ryan Kang
changed print statements in __init__.py to use output wrapper
7d65b3e5683ebcc7b9e0920146a7bf0b20bd28a9 Ryan Kang
fixed Review Bot issues where lines where over 80 characters in __init__.py
43788831f5c440ae0832f705ce943535f8d1936f Ryan Kang
moved OutputWrapper tests from __init__.py to test_main.py and renamed test c...
d8a51ac5c9d2315030b6c514177fc089ab9da020 Ryan Kang
fixed indentation and misspelled words issues in test_main.py:OutputWrapper
5b2937ea7acf8e4e602f03abdd97dde2ebaae997 Ryan Kang
moved OutputWrapper tests to test_main.py and imported KGB
ef64e449e9026ac8a171ef712a8295b30a90a88c Ryan Kang
Added docstrings for OutputWrapper methods
changed stdout_byte to stdout_bytes and stderr_byte to stderr_bytes in Command __init__ String styling changes to properly align tabs and to ensure spaces go on end of strings Changed importing kgb SpyAgency to import kgb Added spacing where needed and alphabetical ordering of test_main.py imports Improved description of OutputWrapperTests in test_main.py
c25d2df4c21dd1da9a1f6f9df6dbdc483ec5bea1 Ryan Kang
Changed docstrings to follow Review Board documentation guide.
Spacing issues between statements fixed Added attributes to Command docstring that summarizes attributes defined in its __init__ Refactored patch.py outputting of byte strings to use self.stdout_bytes properly Indentation issues from lint checkers fixed Fixed docstrings of OutputWrapperTests in test_main.py to format correctly with documentation
86196002cfc2c374c4cfa56123fd63da123e657f Ryan Kang
Fixed multiple blank lines with indentation problems
Fixed lines which exceeded 80 characters Fixed overindentation in setup_repo.py
b7f620e9317c269ef71f3288f6747b02088533f1 Ryan Kang
rbtools/commands/__init__.py
rbtools/commands/alias.py
rbtools/commands/api_get.py
rbtools/commands/attach.py
rbtools/commands/close.py
rbtools/commands/diff.py
rbtools/commands/info.py
rbtools/commands/land.py
rbtools/commands/patch.py
rbtools/commands/post.py
rbtools/commands/publish.py
rbtools/commands/setup_completion.py
rbtools/commands/setup_repo.py
rbtools/commands/stamp.py
rbtools/commands/status.py
rbtools/commands/status_update.py
rbtools/commands/tests/test_main.py
Loading...