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

Method _execute

tools/sampcd_processor.py:568–594  ·  view source on GitHub ↗

Run xdoctest for each example

(self, examples_to_test, examples_nocode)

Source from the content-addressed store, hash-verified

566 return result
567
568 def _execute(self, examples_to_test, examples_nocode):
569 """Run xdoctest for each example"""
570 # patch xdoctest first in each process
571 self._patch_xdoctest()
572
573 # run the xdoctest
574 test_results = []
575 for _, example in examples_to_test.items():
576 start_time = time.time()
577 result = example.run(verbose=self.verbose, on_error='return')
578 end_time = time.time()
579
580 test_results.append(
581 TestResult(
582 name=str(example),
583 passed=result['passed'],
584 skipped=result['skipped'],
585 failed=result['failed'],
586 test_msg=str(result['exc_info']),
587 time=end_time - start_time,
588 )
589 )
590
591 for _, example in examples_nocode.items():
592 test_results.append(TestResult(name=str(example), nocode=True))
593
594 return test_results
595
596 def _execute_with_queue(self, queue, examples_to_test, examples_nocode):
597 queue.put(self._execute(examples_to_test, examples_nocode))

Callers 2

_execute_xdoctestMethod · 0.95
_execute_with_queueMethod · 0.95

Calls 7

_patch_xdoctestMethod · 0.95
TestResultClass · 0.90
strFunction · 0.85
itemsMethod · 0.45
timeMethod · 0.45
runMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected