Compare output of command help with unknown argument with corresponding output of man command

The error message may be different depending on the man tool used.
Therefore, instead of hard-coding it into the test, ensure it is the same as produced by the man command

Closes #512

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2022-11-25 16:50:29 +01:00
parent a38ecf6380
commit d8b7080dcb

View file

@ -34,6 +34,7 @@ import unittest
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Timew, TestCase
from basetest.utils import run_cmd_wait_nofail
class TestHelp(TestCase):
@ -66,8 +67,10 @@ class TestHelp(TestCase):
def test_help_with_unknown_argument_should_show_error_message(self):
"""timew help with unknown argument should show error message"""
code, out, err = self.t.runError("help bogus")
self.assertRegex(err, r"No manual entry for timew-bogus")
_, _, expected = run_cmd_wait_nofail(["man", "timew-bogus"])
_, _, actual = self.t.runError("help bogus")
self.assertEqual(actual, expected)
def test_command_with_help_long_option_should_show_help_page(self):
"""timew command with --help should show help page"""