Add Python version to `rbt --version` output
Review Request #10917 — Created Feb. 25, 2020 and submitted — Latest diff uploaded
Add Python version to
rbt --versionoutput.
sys.versionhas full python version value. The output is
Python 2.7.17 (default, Jan 10 2020, 00:33:00) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)]and
sys.version_infois a key=value pair tuple.
sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0)and
sys.version_info[:3]will get the first 3 keys' values into a tuple.
The output is(2, 7, 17)To format the version for python such as x.x.x, I get each digit in the tuple.
Tested in terminal in
reviewboard-devvirtual env andreviewboard-dev-rbtfor python 2 and 3.
andreviewboard-4.0virtual envs andreviewboard-4.0-rbtfor python 2 and 3.Create TestCase and pass successfully using
./tests/runtests.py rbtools.commands.tests.test_mainand./tests/runtests.py rbtools.commands.tests.test_main:VersionCommandTests. Test number is #246