From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 30 Sep 2024 01:07:04 +0000 (+0200) Subject: [3.13] gh-124245: Fix UserWarning in test_argparse (GH-124246) (#124255) X-Git-Tag: v3.13.0rc3~28 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dceac5b8ea064671aa07b6cb35842955684555f1;p=thirdparty%2FPython%2Fcpython.git [3.13] gh-124245: Fix UserWarning in test_argparse (GH-124246) (#124255) gh-124245: Fix UserWarning in test_argparse (GH-124246) (cherry picked from commit 992e8f6102e317b4967a762fbefea82f9fcf9dfb) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 753a8dad7195..eb744468b556 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -5874,9 +5874,8 @@ class TestIntermixedArgs(TestCase): parser = ErrorRaisingArgumentParser(prog='PROG') parser.add_argument('--foo', nargs="*") parser.add_argument('foo') - with captured_stderr() as stderr: + with self.assertWarns(UserWarning): parser.parse_intermixed_args(['hello', '--foo']) - self.assertIn("UserWarning", stderr.getvalue()) class TestIntermixedMessageContentError(TestCase): # case where Intermixed gives different error message