MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / _execute_xdoctest

Method _execute_xdoctest

tools/sampcd_processor.py:536–566  ·  view source on GitHub ↗
(
        self, examples_to_test, examples_nocode, **directives
    )

Source from the content-addressed store, hash-verified

534 return examples_to_test, examples_nocode
535
536 def _execute_xdoctest(
537 self, examples_to_test, examples_nocode, **directives
538 ):
539 # if use solo(single process), execute without multiprocessing/thread
540 if directives.get('solo') is not None:
541 return self._execute(examples_to_test, examples_nocode)
542
543 if self._use_multiprocessing:
544 _ctx = multiprocessing.get_context('spawn')
545 result_queue = _ctx.Queue()
546 exec_processor = functools.partial(_ctx.Process, daemon=True)
547 else:
548 result_queue = queue.Queue()
549 exec_processor = functools.partial(threading.Thread, daemon=True)
550
551 processor = exec_processor(
552 target=self._execute_with_queue,
553 args=(
554 result_queue,
555 examples_to_test,
556 examples_nocode,
557 ),
558 )
559
560 processor.start()
561 result = result_queue.get(
562 timeout=directives.get('timeout', TEST_TIMEOUT)
563 )
564 processor.join()
565
566 return result
567
568 def _execute(self, examples_to_test, examples_nocode):
569 """Run xdoctest for each example"""

Callers 1

runMethod · 0.95

Calls 5

_executeMethod · 0.95
getMethod · 0.45
get_contextMethod · 0.45
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected