(args, doctester: DocTester)
| 796 | |
| 797 | |
| 798 | def run_doctest(args, doctester: DocTester): |
| 799 | # init logger |
| 800 | init_logger(debug=args.debug, log_file=args.logf) |
| 801 | |
| 802 | logger.info("----------------Codeblock Check Start--------------------") |
| 803 | |
| 804 | logger.info(">>> Check test mode ...") |
| 805 | run_on_device = check_test_mode(mode=args.mode, gpu_id=args.gpu_id) |
| 806 | |
| 807 | logger.info(">>> Get test capacity ...") |
| 808 | sample_code_test_capacity = get_test_capacity(run_on_device) |
| 809 | |
| 810 | logger.info(">>> Get docstring from api ...") |
| 811 | docstrings_to_test, whl_error = get_docstring(full_test=args.full_test) |
| 812 | |
| 813 | logger.info(">>> Checking plain sample code style before Paddle 2.5 ...") |
| 814 | check_old_style(docstrings_to_test) |
| 815 | |
| 816 | logger.info(">>> Prepare doctester ...") |
| 817 | doctester.prepare(sample_code_test_capacity) |
| 818 | |
| 819 | logger.info(">>> Running doctester ...") |
| 820 | test_results = get_test_results(doctester, docstrings_to_test) |
| 821 | |
| 822 | logger.info(">>> Print summary ...") |
| 823 | doctester.print_summary(test_results, whl_error) |
| 824 | |
| 825 | if args.mode == "cpu": |
| 826 | # As cpu mode is also run with the GPU whl, so skip it in gpu mode. |
| 827 | exec_gen_doc() |
| 828 | |
| 829 | |
| 830 | def parse_args(): |
no test coverage detected