util: testing: Move core docstrings test logic into main package
See original GitHub issueWe should refactor tests/test_docstrings.py
into dffml/util/testing/docstrings.py
and make it so that the plugins all have a file under their tests which imports and uses the docstring test code so that the plugins docstrings are always tested.
The goal here is to take out as much code as possible from tests/test_docstrings.py
and make it into something which the plugins could import from plugins. For example, say we ran dffml service dev create model dffml-model-myslr
, and wrote some python examples for the model within the docstring using >>>
syntax. We also wrote a util.py
with a function and that function has >>>
style examples in it (see dffml/util/data.py
for examples). The goal of this issue is that to test both these examples. We only need to add the following to a tests/test_docstring.py
file:
dffml/skel/common/tests/test_docstring.py
import pathlib
from dffml.util.testing.docstrings import make_docstring_tests
REPO_ROOT = pathlib.Path(__file__).parents[1]
for TestCase in make_docstring_tests(REPO_ROOT):
setattr(sys.modules[__name__], TestCase.__qaulname__, TestCase)
Our new function, make_docstring_tests()
, should be essentially the same as the last two for loops in the the old version.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
@programmer290399 this is a critical one for 2ndparty
@aitikgupta I’ve updated the issue body, sorry for the slow response! Let me know if you have further questions.
You may have moved on to other things, so for anyone else reading this, the issue is up for grabs, subject to the contributing guidelines: https://intel.github.io/dffml/master/contributing/dev_community.html#communication-style