Skip to content

Commit e76464d

Browse files
authored
gh-131178: Fix test_unknown_flag for platform CLI (#137816)
1 parent ed53c63 commit e76464d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Lib/test/test_platform.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,13 +770,14 @@ def invoke_platform(self, *flags):
770770
platform._main(args=flags)
771771
return output.getvalue()
772772

773+
@support.force_not_colorized
773774
def test_unknown_flag(self):
775+
output = io.StringIO()
774776
with self.assertRaises(SystemExit):
775-
output = io.StringIO()
776777
# suppress argparse error message
777778
with contextlib.redirect_stderr(output):
778779
_ = self.invoke_platform('--unknown')
779-
self.assertStartsWith(output, "usage: ")
780+
self.assertStartsWith(output.getvalue(), "usage: ")
780781

781782
def test_invocation(self):
782783
flags = (

0 commit comments

Comments
 (0)