Fixed issues with rbtools argument parsing on Python 3 when running '--help'

Review Request #10856 — Created Jan. 24, 2020 and submitted — Latest diff uploaded

Information

RBTools
release-2.0.x
392c050...

Reviewers

On python 2, running rbt --help <command> and rbt <command> --help
are equivalent. However, running rbt <command> --help does not work
on python 3. This happens because byte strings are utilized in the
code to see if --help or -h are passed in as arguments. They are
never found because the code is trying to find b'--help' or b'-h'.
In python 2, b'--help' is equivalent to '--help', but in python 3,
this is not the case.

To fix this issue, the byte strings b'--help' and b’-h’ have been
changed to python 3 compatible strings (i.e. --help and -h). Unit
tests have also been added to ensure that all possible positions and
cases of the 'help' argument work for rbtools.(ex. rbt —help <command>,
rbt <command> -h, rbt help <command>, etc.).

All tests were run using both python 2.7.17 and python 3.7.6.

Test cases run on python 2.7.17 and 3.7.6:
Test case where rbt help <command> is run
Test case where rbt <command> --help or rbt <command> -h is run
Test case where rbt --help <command> or rbt -h <command> is run
Test case where an invalid rbt command is run with help
Test case where multiple arguments are entered

    Loading...