From d7f7f9defcf3038a31e2aebf292ae4df56ba336d Mon Sep 17 00:00:00 2001 From: Alexander Shadchin Date: Sun, 11 Aug 2024 16:28:40 +0300 Subject: [PATCH] Fix `test_add_subparsers_twice` with Python 3.12.5 --- tests/test_subparser.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_subparser.py b/tests/test_subparser.py index b73cb24..b618fcc 100644 --- a/tests/test_subparser.py +++ b/tests/test_subparser.py @@ -134,8 +134,12 @@ def configure(self): self.add_subparsers(help="sub-command1 help") self.add_subparsers(help="sub-command2 help") - with self.assertRaises(SystemExit): - Args().parse_args([]) + if sys.version_info >= (3, 12, 5): + with self.assertRaises(ArgumentError): + Args().parse_args([]) + else: + with self.assertRaises(SystemExit): + Args().parse_args([]) def test_add_subparsers_with_add_argument(self): class SubparserA(Tap):