diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 8a4fdb90a6d..b61572270e9 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -235,8 +235,8 @@ class ParserTesterMetaclass(type): parser = self._get_parser(tester) for args_str in tester.failures: args = args_str.split() - raises = tester.assertRaises - raises(ArgumentParserError, parser.parse_args, args) + with tester.assertRaises(ArgumentParserError, msg=args): + parser.parse_args(args) def test_successes(self, tester): parser = self._get_parser(tester)