Skip to content

Commit

Permalink
adds a bit of doctest hint on why the key and value getters are separ…
Browse files Browse the repository at this point in the history
…ate functions.
  • Loading branch information
hartym committed Jul 23, 2016
1 parent 1a33025 commit ec7695e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions _pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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():
"""
Expand Down

0 comments on commit ec7695e

Please sign in to comment.