def METHOD_NAME(args, regex=None):
    old_stderr = sys.stderr
    stderr = sys.stderr = StringIO()
    try:
        self.assertRaises(SystemExit, parse_command_line, list(args))
    finally:
        sys.stderr = old_stderr
    msg = stderr.getvalue().strip()
    self.assertTrue(msg)
    if regex:
        self.assertTrue(re.search(regex, msg),
                        '"%s" does not match search "%s"' %
                        (msg, regex))