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)
| 711 | |
| 712 | |
| 713 | def _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") |