https://github.com/python/cpython/commit/e76464d161f2e7f2c27c84f8de4de5f88f025973
commit: e76464d161f2e7f2c27c84f8de4de5f88f025973
branch: main
author: Semyon Moroz <[email protected]>
committer: kumaraditya303 <[email protected]>
date: 2025-09-05T16:59:46+05:30
summary:
gh-131178: Fix `test_unknown_flag` for platform CLI (#137816)
files:
M Lib/test/test_platform.py
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 601d450b7de9eb..c07f96aecf4a78 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -770,13 +770,14 @@ def invoke_platform(self, *flags):
platform._main(args=flags)
return output.getvalue()
+ @support.force_not_colorized
def test_unknown_flag(self):
+ output = io.StringIO()
with self.assertRaises(SystemExit):
- output = io.StringIO()
# suppress argparse error message
with contextlib.redirect_stderr(output):
_ = self.invoke_platform('--unknown')
- self.assertStartsWith(output, "usage: ")
+ self.assertStartsWith(output.getvalue(), "usage: ")
def test_invocation(self):
flags = (
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]