]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-124245: Fix UserWarning in test_argparse (GH-124246) (#124255)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 30 Sep 2024 01:07:04 +0000 (03:07 +0200)
committerGitHub <noreply@github.com>
Mon, 30 Sep 2024 01:07:04 +0000 (18:07 -0700)
gh-124245: Fix UserWarning in test_argparse (GH-124246)
(cherry picked from commit 992e8f6102e317b4967a762fbefea82f9fcf9dfb)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/test_argparse.py

index 753a8dad7195ae6a907bf2a12045d5484d91785b..eb744468b55602d3aad793ffa62296f4607c50e3 100644 (file)
@@ -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