MCPcopy Index your code
hub / github.com/ipython/ipython / collect

Method collect

IPython/testing/plugin/pytest_ipdoctest.py:500–526  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

498 obj = None
499
500 def collect(self) -> Iterable[IPDoctestItem]:
501 import doctest
502 from .ipdoctest import IPDocTestParser
503
504 # Inspired by doctest.testfile; ideally we would use it directly,
505 # but it doesn't support passing a custom checker.
506 encoding = self.config.getini("ipdoctest_encoding")
507 text = self.path.read_text(encoding)
508 filename = str(self.path)
509 name = self.path.name
510 globs = {"__name__": "__main__"}
511
512 optionflags = get_optionflags(self)
513
514 runner = _get_runner(
515 verbose=False,
516 optionflags=optionflags,
517 checker=_get_checker(),
518 continue_on_failure=_get_continue_on_failure(self.config),
519 )
520
521 parser = IPDocTestParser()
522 test = parser.get_doctest(text, globs, name, filename, 0)
523 if test.examples:
524 yield IPDoctestItem.from_parent(
525 self, name=test.name, runner=runner, dtest=test
526 )
527
528 if pytest_version[0] < 7:
529

Callers

nothing calls this directly

Calls 6

get_optionflagsFunction · 0.85
_get_runnerFunction · 0.85
_get_checkerFunction · 0.85
_get_continue_on_failureFunction · 0.85
IPDocTestParserClass · 0.85
from_parentMethod · 0.45

Tested by

no test coverage detected