MCPcopy Create free account
hub / github.com/pytest-dev/pytest / parse_args

Method parse_args

src/_pytest/config/argparsing.py:417–432  ·  view source on GitHub ↗

Allow splitting of positional arguments.

(  # type: ignore
        self,
        args: Optional[Sequence[str]] = None,
        namespace: Optional[argparse.Namespace] = None,
    )

Source from the content-addressed store, hash-verified

415
416 # Type ignored because typeshed has a very complex type in the superclass.
417 def parse_args( # type: ignore
418 self,
419 args: Optional[Sequence[str]] = None,
420 namespace: Optional[argparse.Namespace] = None,
421 ) -> argparse.Namespace:
422 """Allow splitting of positional arguments."""
423 parsed, unrecognized = self.parse_known_args(args, namespace)
424 if unrecognized:
425 for arg in unrecognized:
426 if arg and arg[0] == "-":
427 lines = ["unrecognized arguments: %s" % (" ".join(unrecognized))]
428 for k, v in sorted(self.extra_info.items()):
429 lines.append(f" {k}: {v}")
430 self.error("\n".join(lines))
431 getattr(parsed, FILE_OR_DIR).extend(unrecognized)
432 return parsed
433
434 if sys.version_info[:2] < (3, 9): # pragma: no cover
435 # Backport of https://github.com/python/cpython/pull/14316 so we can

Callers 6

get_issues.pyFile · 0.80
parseMethod · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 3

errorMethod · 0.95
parse_known_argsMethod · 0.80
appendMethod · 0.80

Tested by 1