Skip to content

Commit b4cfc97

Browse files
committed
pythongh-131178: Fix test_unknown_flag for platform CLI
1 parent 75d20b2 commit b4cfc97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/test/test_platform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,12 +763,12 @@ def invoke_platform(self, *flags):
763763
return output.getvalue()
764764

765765
def test_unknown_flag(self):
766+
output = io.StringIO()
766767
with self.assertRaises(SystemExit):
767-
output = io.StringIO()
768768
# suppress argparse error message
769769
with contextlib.redirect_stderr(output):
770770
_ = self.invoke_platform('--unknown')
771-
self.assertStartsWith(output, "usage: ")
771+
self.assertStartsWith(output.getvalue(), "usage: ")
772772

773773
def test_invocation(self):
774774
flags = (

0 commit comments

Comments
 (0)