Skip to content

Commit cd389f5

Browse files
committed
Check for start of help command in tests which show help
1 parent 48e3559 commit cd389f5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Lib/test/test_platform.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,9 +757,11 @@ def invoke_platform(self, *flags):
757757

758758
def test_unknown_flag(self):
759759
with self.assertRaises(SystemExit):
760+
output = io.StringIO()
760761
# suppress argparse error message
761-
with contextlib.redirect_stderr(io.StringIO()):
762+
with contextlib.redirect_stderr(output):
762763
_ = self.invoke_platform('--unknown')
764+
self.assertStartsWith(output, "usage: ")
763765

764766
def test_invocation(self):
765767
flags = (
@@ -800,7 +802,7 @@ def test_help(self):
800802
with contextlib.redirect_stdout(output):
801803
platform._main(args=["--help"])
802804

803-
self.assertIn("usage:", output.getvalue())
805+
self.assertStartsWith(output.getvalue(), "usage:")
804806

805807

806808
if __name__ == '__main__':

0 commit comments

Comments
 (0)