This ticket improves a few things about how doctest treats pytest.
-
Introduce the option to specify in function doc TESTS: pytest. This marks the function as tested for the sage-coverage command. Sometimes (but rarely) you have private or protected methods that don't need a proper "EXAMPLES" doctest. In these cases, one can decide to either write traditional TESTS or use pytest to test the method. In the later case, sage-coverage would mark the function as not tested as it's not aware of pytest; so we have to specify explicitly that we use pytest to cover this method. One could even argue that private/protected methods shouldn't be directly tested at all as they are implementation details; but let's not open this discussion.
-
Remove _test.py files from doctest coverage. By our convention, these are pytest files and thus almost never have (extensive) doctests.
-
To make this work, existing xyz_test.py files that are not using pytest are renamed to test_xyz.py.
CC: @mkoeppe @fchapoton @egourgoulhon @tornaria
Component: doctest coverage
Author: Tobias Diez
Branch/Commit: 01f376c
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/32975
This ticket improves a few things about how doctest treats pytest.
Introduce the option to specify in function doc
TESTS: pytest. This marks the function as tested for thesage-coveragecommand. Sometimes (but rarely) you have private or protected methods that don't need a proper "EXAMPLES" doctest. In these cases, one can decide to either write traditionalTESTSor use pytest to test the method. In the later case,sage-coveragewould mark the function as not tested as it's not aware of pytest; so we have to specify explicitly that we use pytest to cover this method. One could even argue that private/protected methods shouldn't be directly tested at all as they are implementation details; but let's not open this discussion.Remove
_test.pyfiles from doctest coverage. By our convention, these are pytest files and thus almost never have (extensive) doctests.To make this work, existing
xyz_test.pyfiles that are not using pytest are renamed totest_xyz.py.CC: @mkoeppe @fchapoton @egourgoulhon @tornaria
Component: doctest coverage
Author: Tobias Diez
Branch/Commit:
01f376cReviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/32975