(args, **kwargs)
| 442 | |
| 443 | |
| 444 | def _parse_args(args, **kwargs): |
| 445 | # Defaults |
| 446 | ns = Namespace() |
| 447 | for k, v in kwargs.items(): |
| 448 | if not hasattr(ns, k): |
| 449 | raise TypeError('%r is an invalid keyword argument ' |
| 450 | 'for this function' % k) |
| 451 | setattr(ns, k, v) |
| 452 | |
| 453 | parser = _create_parser() |
| 454 | # Issue #14191: argparse doesn't support "intermixed" positional and |
| 455 | # optional arguments. Use parse_known_args() as workaround. |
| 456 | ns.args = parser.parse_known_args(args=args, namespace=ns)[1] |
| 457 | for arg in ns.args: |
| 458 | if arg.startswith('-'): |
| 459 | parser.error("unrecognized arguments: %s" % arg) |
| 460 | |
| 461 | if ns.timeout is not None: |
| 462 | # Support "--timeout=" (no value) so Makefile.pre.pre TESTTIMEOUT |
| 463 | # can be used by "make buildbottest" and "make test". |
| 464 | if ns.timeout != "": |
| 465 | try: |
| 466 | ns.timeout = float(ns.timeout) |
| 467 | except ValueError: |
| 468 | parser.error(f"invalid timeout value: {ns.timeout!r}") |
| 469 | else: |
| 470 | ns.timeout = None |
| 471 | |
| 472 | # Continuous Integration (CI): common options for fast/slow CI modes |
| 473 | if ns.slow_ci or ns.fast_ci: |
| 474 | # Similar to options: |
| 475 | # -j0 --randomize --fail-env-changed --rerun --slowest --verbose3 |
| 476 | if ns.use_mp is None: |
| 477 | ns.use_mp = 0 |
| 478 | ns.randomize = True |
| 479 | ns.fail_env_changed = True |
| 480 | if ns.python is None: |
| 481 | ns.rerun = True |
| 482 | ns.print_slow = True |
| 483 | if not ns.verbose: |
| 484 | ns.verbose3 = True |
| 485 | else: |
| 486 | # --verbose has the priority over --verbose3 |
| 487 | pass |
| 488 | else: |
| 489 | ns._add_python_opts = False |
| 490 | |
| 491 | # --singleprocess overrides -jN option |
| 492 | if ns.single_process: |
| 493 | ns.use_mp = None |
| 494 | |
| 495 | # When both --slow-ci and --fast-ci options are present, |
| 496 | # --slow-ci has the priority |
| 497 | if ns.slow_ci: |
| 498 | # Similar to: -u "all" --timeout=1200 |
| 499 | if ns.use is None: |
| 500 | ns.use = [] |
| 501 | ns.use[:0] = [('all', None)] |
no test coverage detected
searching dependent graphs…