diff --git a/_pytest/doctest.py b/_pytest/doctest.py index 59846a21d..e4e028535 100644 --- a/_pytest/doctest.py +++ b/_pytest/doctest.py @@ -295,7 +295,18 @@ def _get_allow_bytes_flag(): return doctest.register_optionflag('ALLOW_BYTES') +def _get_report_choices_keys(): + """ + Returns the report choices keys. Separate function (see just below) because this is used to declare options and + we can't import the doctest module at that time. + """ + return ('udiff', 'cdiff', 'ndiff', 'only_first_failure', 'none', ) + def _get_report_choices(): + """ + See `_get_report_choices_keys` to understand why this strange implementation. Be careful with order, the values + order should be the same as the returned keys above. + """ import doctest return dict( zip( @@ -304,9 +315,6 @@ def _get_report_choices(): ) ) -def _get_report_choices_keys(): - return ('udiff', 'cdiff', 'ndiff', 'only_first_failure', 'none', ) - @pytest.fixture(scope='session') def doctest_namespace(): """