MCPcopy Index your code
hub / github.com/RustPython/RustPython / main

Function main

scripts/update_lib/cmd_auto_mark.py:999–1040  ·  view source on GitHub ↗
(argv: list[str] | None = None)

Source from the content-addressed store, hash-verified

997
998
999def main(argv: list[str] | None = None) -> int:
1000 import argparse
1001
1002 parser = argparse.ArgumentParser(
1003 description=__doc__,
1004 formatter_class=argparse.RawDescriptionHelpFormatter,
1005 )
1006 parser.add_argument(
1007 "path",
1008 type=pathlib.Path,
1009 help="Path to test file or directory (e.g., Lib/test/test_foo.py or Lib/test/test_foo/)",
1010 )
1011 parser.add_argument(
1012 "--mark-failure",
1013 action="store_true",
1014 help="Also add @expectedFailure to failing tests (default: only remove unexpected successes)",
1015 )
1016 parser.add_argument(
1017 "--build",
1018 action=argparse.BooleanOptionalAction,
1019 default=True,
1020 help="Build with cargo (default: enabled)",
1021 )
1022
1023 args = parser.parse_args(argv)
1024
1025 try:
1026 if args.path.is_dir():
1027 num_added, num_removed, _ = auto_mark_directory(
1028 args.path, mark_failure=args.mark_failure, skip_build=not args.build
1029 )
1030 else:
1031 num_added, num_removed, _ = auto_mark_file(
1032 args.path, mark_failure=args.mark_failure, skip_build=not args.build
1033 )
1034 if args.mark_failure:
1035 print(f"Added expectedFailure to {num_added} tests")
1036 print(f"Removed expectedFailure from {num_removed} tests")
1037 return 0
1038 except (FileNotFoundError, ValueError) as e:
1039 print(f"Error: {e}", file=sys.stderr)
1040 return 1
1041
1042
1043if __name__ == "__main__":

Callers 1

cmd_auto_mark.pyFile · 0.70

Calls 6

parse_argsMethod · 0.95
auto_mark_directoryFunction · 0.85
auto_mark_fileFunction · 0.85
printFunction · 0.50
add_argumentMethod · 0.45
is_dirMethod · 0.45

Tested by

no test coverage detected