MCPcopy Create free account
hub / github.com/pytest-dev/pytest / _get_report_choice

Function _get_report_choice

src/_pytest/doctest.py:713–727  ·  view source on GitHub ↗

Return the actual `doctest` module flag value. We want to do it as late as possible to avoid importing `doctest` and all its dependencies when parsing options, as it adds overhead and breaks tests.

(key: str)

Source from the content-addressed store, hash-verified

711
712
713def _get_report_choice(key: str) -> int:
714 """Return the actual `doctest` module flag value.
715
716 We want to do it as late as possible to avoid importing `doctest` and all
717 its dependencies when parsing options, as it adds overhead and breaks tests.
718 """
719 import doctest
720
721 return {
722 DOCTEST_REPORT_CHOICE_UDIFF: doctest.REPORT_UDIFF,
723 DOCTEST_REPORT_CHOICE_CDIFF: doctest.REPORT_CDIFF,
724 DOCTEST_REPORT_CHOICE_NDIFF: doctest.REPORT_NDIFF,
725 DOCTEST_REPORT_CHOICE_ONLY_FIRST_FAILURE: doctest.REPORT_ONLY_FIRST_FAILURE,
726 DOCTEST_REPORT_CHOICE_NONE: 0,
727 }[key]
728
729
730@pytest.fixture(scope="session")

Callers 1

repr_failureMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected