Run xdoctest for each example
(self, examples_to_test, examples_nocode)
| 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)) |
no test coverage detected