fname stringlengths 63 176 | rel_fname stringclasses 706
values | line int64 -1 4.5k | name stringlengths 1 81 | kind stringclasses 2
values | category stringclasses 2
values | info stringlengths 0 77.9k ⌀ |
|---|---|---|---|---|---|---|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/deprecated.py | src/_pytest/deprecated.py | 126 | PytestRemovedIn8Warning | ref | function | INSTANCE_COLLECTOR = PytestRemovedIn8Warning(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/deprecated.py | src/_pytest/deprecated.py | 150 | check_ispytest | def | function | def check_ispytest(ispytest: bool) -> None:
if not ispytest:
warn(PRIVATE, stacklevel=3)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 65 | pytest_addoption | def | function | def pytest_addoption(parser: Parser) -> None:
parser.addini(
"doctest_optionflags",
"option flags for doctests",
type="args",
default=["ELLIPSIS"],
)
parser.addini(
"doctest_encoding", "encoding used for doctest files", default="utf-8"
)
group = parser.getgrou... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 66 | addini | ref | function | parser.addini(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 72 | addini | ref | function | parser.addini(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 75 | getgroup | ref | function | group = parser.getgroup("collect")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 76 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 83 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 91 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 99 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 106 | addoption | ref | function | group.addoption(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 115 | pytest_unconfigure | def | function | def pytest_unconfigure() -> None:
global RUNNER_CLASS
RUNNER_CLASS = None
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 121 | pytest_collect_file | def | function | def pytest_collect_file(
fspath: Path,
parent: Collector,
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 128 | _is_setup_py | ref | function | (_is_setup_py(fspath), _is_main_py(fspath))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 128 | _is_main_py | ref | function | (_is_setup_py(fspath), _is_main_py(fspath))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 130 | from_parent | ref | function | mod: DoctestModule = DoctestModule.from_parent(parent, path=fspath)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 132 | _is_doctest | ref | function | elif _is_doctest(config, fspath, parent):
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 133 | from_parent | ref | function | txt: DoctestTextfile = DoctestTextfile.from_parent(parent, path=fspath)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 138 | _is_setup_py | def | function | def _is_setup_py(path: Path) -> bool:
if path.name != "setup.py":
return _False
contents = path.read_bytes()
return b"setuptools" in contents or b"distutils" in contents
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 145 | _is_doctest | def | function | def _is_doctest(config: Config, path: Path, parent: Collector) -> bool:
if path.suffix in (".txt", ".rst") and parent.session.isinitpath(path):
return _True
globs = config.getoption("doctestglob") or ["test*.txt"]
return any(fnmatch_ex(glob, path) for glob in globs)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 146 | isinitpath | ref | function | if path.suffix in (".txt", ".rst") and parent.session.isinitpath(path):
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 148 | getoption | ref | function | globs = config.getoption("doctestglob") or ["test*.txt"]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 149 | fnmatch_ex | ref | function | return any(fnmatch_ex(glob, path) for glob in globs)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 152 | _is_main_py | def | function | def _is_main_py(path: Path) -> bool:
return path.name == "__main__.py"
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 156 | ReprFailDoctest | def | class | __init__ toterminal |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 162 | toterminal | def | function | def toterminal(self, tw: TerminalWriter) -> None:
for reprlocation, lines in self.reprlocation_lines:
for line in lines:
tw.line(line)
reprlocation.toterminal(tw)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 165 | line | ref | function | tw.line(line)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 166 | toterminal | ref | function | reprlocation.toterminal(tw)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 169 | MultipleDoctestFailures | def | class | __init__ |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 175 | _init_runner_class | def | class | |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 178 | PytestDoctestRunner | def | class | __init__ report_failure report_unexpected_exception |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 195 | report_failure | def | function | def report_failure(
self,
out,
test: "doctest.DocTest",
example: "doctest.Example",
got: str,
) -> None:
failure = doctest.DocTestFailure(test, example, got)
if self.continue_on_failure:
out.append(failur... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 202 | DocTestFailure | ref | function | failure = doctest.DocTestFailure(test, example, got)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 208 | report_unexpected_exception | def | function | def report_unexpected_exception(
self,
out,
test: "doctest.DocTest",
example: "doctest.Example",
exc_info: Tuple[Type[BaseException], BaseException, types.TracebackType],
) -> None:
if isinstance(exc_info[1], OutcomeException):
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 219 | UnexpectedException | ref | function | failure = doctest.UnexpectedException(test, example, exc_info)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 228 | _get_runner | def | function | def _get_runner(
checker: Optional["doctest.OutputChecker"] = None,
verbose: Optional[bool] = None,
optionflags: int = 0,
continue_on_failure: bool = _True,
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 237 | _init_runner_class | ref | class | |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 240 | RUNNER_CLASS | ref | function | return RUNNER_CLASS( # type: ignore
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 248 | DoctestItem | def | class | __init__ from_parent setup runtest _disable_output_capturing_for_darwin repr_failure reportinfo |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 263 | from_parent | def | function | def from_parent( # type: ignore
cls,
parent: "Union[DoctestTextfile, DoctestModule]",
*,
name: str,
runner: "doctest.DocTestRunner",
dtest: "doctest.DocTest",
):
# incompatible signature due to imposed limits on subclass
"""The public named constr... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 273 | from_parent | ref | function | return super().from_parent(name=name, parent=parent, runner=runner, dtest=dtest)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 275 | setup | def | function | def setup(self) -> None:
if self.dtest is not None:
self.fixture_request = _setup_fixtures(self)
globs = dict(getfixture=self.fixture_request.getfixturevalue)
for name, value in self.fixture_request.getfixturevalue(
"doctest_namespace"
).items(... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 277 | _setup_fixtures | ref | function | self.fixture_request = _setup_fixtures(self)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 279 | getfixturevalue | ref | function | for name, value in self.fixture_request.getfixturevalue(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 285 | runtest | def | function | def runtest(self) -> None:
assert self.dtest is not None
assert self.runner is not None
_check_all_skipped(self.dtest)
self._disable_output_capturing_for_darwin()
failures: List["doctest.DocTestFailure"] = []
# Type ignored because we change the type of `out` from wha... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 288 | _check_all_skipped | ref | function | _check_all_skipped(self.dtest)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 289 | _disable_output_capturing_for_darwin | ref | function | self._disable_output_capturing_for_darwin()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 293 | run | ref | function | self.runner.run(self.dtest, out=failures) # type: ignore[arg-type]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 295 | MultipleDoctestFailures | ref | function | raise MultipleDoctestFailures(failures)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 297 | _disable_output_capturing_for_darwin | def | function | def _disable_output_capturing_for_darwin(self) -> None:
"""Disable output capturing. Otherwise, stdout is lost to doctest (#985)."""
if platform.system() != "Darwin":
return
capman = self.config.pluginmanager.getplugin("capturemanager")
if capman:
capman.suspe... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 301 | getplugin | ref | function | capman = self.config.pluginmanager.getplugin("capturemanager")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 303 | suspend_global_capture | ref | function | capman.suspend_global_capture(in_=True)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 304 | read_global_capture | ref | function | out, err = capman.read_global_capture()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 309 | repr_failure | def | function | def repr_failure( # type: ignore[override]
self,
excinfo: ExceptionInfo[BaseException],
) -> Union[str, TerminalRepr]:
import doctest
failures: Optional[
Sequence[Union[doctest.DocTestFailure, doctest.UnexpectedException]]
] = None
if isinstance(
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 326 | repr_failure | ref | function | return super().repr_failure(excinfo)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 339 | ReprFileLocation | ref | function | reprlocation = ReprFileLocation(filename, lineno, message) # type: ignore[arg-type]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 340 | _get_checker | ref | function | checker = _get_checker()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 341 | _get_report_choice | ref | function | report_choice = _get_report_choice(self.config.getoption("doctestreport"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 341 | getoption | ref | function | report_choice = _get_report_choice(self.config.getoption("doctestreport"))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 361 | output_difference | ref | function | lines += checker.output_difference(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 365 | from_exc_info | ref | function | inner_excinfo = ExceptionInfo.from_exc_info(failure.exc_info)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 371 | ReprFailDoctest | ref | function | return ReprFailDoctest(reprlocation_lines)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 373 | reportinfo | def | function | def reportinfo(self) -> Tuple[Union["os.PathLike[str]", str], Optional[int], str]:
assert self.dtest is not None
return self.path, self.dtest.lineno, "[doctest] %s" % self.name
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 378 | _get_flag_lookup | def | function | def _get_flag_lookup() -> Dict[str, int]:
import doctest
return dict(
DONT_ACCEPT_TRUE_FOR_1=doctest.DONT_ACCEPT_TRUE_FOR_1,
DONT_ACCEPT_BLANKLINE=doctest.DONT_ACCEPT_BLANKLINE,
NORMALIZE_WHITESPACE=doctest.NORMALIZE_WHITESPACE,
ELLIPSIS=doctest.ELLIPSIS,
IGNORE_EXCEPTIO... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 388 | _get_allow_unicode_flag | ref | function | ALLOW_UNICODE=_get_allow_unicode_flag(),
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 389 | _get_allow_bytes_flag | ref | function | ALLOW_BYTES=_get_allow_bytes_flag(),
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 390 | _get_number_flag | ref | function | NUMBER=_get_number_flag(),
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 394 | get_optionflags | def | function | def get_optionflags(parent):
optionflags_str = parent.config.getini("doctest_optionflags")
flag_lookup_table = _get_flag_lookup()
flag_acc = 0
for flag in optionflags_str:
flag_acc |= flag_lookup_table[flag]
return flag_acc
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 395 | getini | ref | function | optionflags_str = parent.config.getini("doctest_optionflags")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 396 | _get_flag_lookup | ref | function | flag_lookup_table = _get_flag_lookup()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 403 | _get_continue_on_failure | def | function | def _get_continue_on_failure(config):
continue_on_failure = config.getvalue("doctest_continue_on_failure")
if continue_on_failure:
# We need to turn off this if we use pdb since we should stop at
# the first failure.
if config.getvalue("usepdb"):
continue_on_failure = _False
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 404 | getvalue | ref | function | continue_on_failure = config.getvalue("doctest_continue_on_failure")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 408 | getvalue | ref | function | if config.getvalue("usepdb"):
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 413 | DoctestTextfile | def | class | collect |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 416 | collect | def | function | def collect(self) -> Iterable[DoctestItem]:
import doctest
# Inspired by doctest.testfile; ideally we would use it directly,
# but it doesn't support passing a custom checker.
encoding = self.config.getini("doctest_encoding")
text = self.path.read_text(encoding)
file... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 421 | getini | ref | function | encoding = self.config.getini("doctest_encoding")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 427 | get_optionflags | ref | function | optionflags = get_optionflags(self)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 429 | _get_runner | ref | function | runner = _get_runner(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 432 | _get_checker | ref | function | checker=_get_checker(),
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 433 | _get_continue_on_failure | ref | function | continue_on_failure=_get_continue_on_failure(self.config),
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 436 | DocTestParser | ref | function | parser = doctest.DocTestParser()
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 437 | get_doctest | ref | function | test = parser.get_doctest(text, globs, name, filename, 0)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 439 | from_parent | ref | function | yield DoctestItem.from_parent(
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 444 | _check_all_skipped | def | function | def _check_all_skipped(test: "doctest.DocTest") -> None:
"""Raise pytest.skip() if all examples in the given DocTest have the SKIP
option set."""
import doctest
all_skipped = all(x.options.get(doctest.SKIP, _False) for x in test.examples)
if all_skipped:
pytest.skip("all tests skipped by +S... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 451 | skip | ref | function | pytest.skip("all tests skipped by +SKIP option")
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 454 | _is_mocked | def | function | def _is_mocked(obj: object) -> bool:
"""Return if an object is possibly a mock object by checking the
existence of a highly improbable attribute."""
return (
safe_getattr(obj, "pytest_mock_example_attribute_that_shouldnt_exist", None)
is not None
)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 458 | safe_getattr | ref | function | safe_getattr(obj, "pytest_mock_example_attribute_that_shouldnt_exist", None)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 464 | _patch_unwrap_mock_aware | def | function | def _patch_unwrap_mock_aware() -> Generator[None, None, None]:
"""Context manager which replaces ``inspect.unwrap`` with a version
that's aware of mock objects and doesn't recurse into them."""
real_unwrap = inspect.unwrap
def _mock_aware_unwrap(
func: Callable[..., Any], *, stop: Optional[Call... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 469 | _mock_aware_unwrap | def | function | def _mock_aware_unwrap(
func: Callable[..., Any], *, stop: Optional[Callable[[Any], Any]] = None
) -> Any:
try:
if stop is None or stop is _is_mocked:
return real_unwrap(func, stop=_is_mocked)
_stop = stop
return real_unwrap(func, stop=lambda o... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 474 | real_unwrap | ref | function | return real_unwrap(func, stop=_is_mocked)
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 476 | real_unwrap | ref | function | return real_unwrap(func, stop=lambda obj: _is_mocked(obj) or _stop(func))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 476 | _is_mocked | ref | function | return real_unwrap(func, stop=lambda obj: _is_mocked(obj) or _stop(func))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 476 | _stop | ref | function | return real_unwrap(func, stop=lambda obj: _is_mocked(obj) or _stop(func))
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 493 | DoctestModule | def | class | collect |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 494 | collect | def | function | def collect(self) -> Iterable[DoctestItem]:
import doctest
# Inspired by doctest.testfile; ideally we would use it directly,
# but it doesn't support passing a custom checker.
encoding = self.config.getini("doctest_encoding")
text = self.path.read_text(encoding)
file... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 497 | MockAwareDocTestFinder | def | class | _find_lineno _find |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 504 | _find_lineno | def | function | def _find_lineno(self, obj, source_lines):
"""Doctest code does not take into account `@property`, this
is a hackish way to fix it. https://bugs.python.org/issue17446
Wrapped Doctests will need to be unwrapped so the correct
line number is ret... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 519 | _find_lineno | ref | function | return super()._find_lineno( # type:ignore[misc]
|
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 524 | _find | def | function | def _find(
self, tests, obj, name, module, source_lines, globs, seen
) -> None:
if _is_mocked(obj):
return
with _patch_unwrap_mock_aware():
# Type ignored because this is a private function.
... |
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/src/_pytest/doctest.py | src/_pytest/doctest.py | 527 | _is_mocked | ref | function | if _is_mocked(obj):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.