question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

util: testing: Move core docstrings test logic into main package

See original GitHub issue

We 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:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pdxjohnnycommented, Oct 19, 2021

@programmer290399 this is a critical one for 2ndparty

1reaction
pdxjohnnycommented, Feb 12, 2021

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

doctest — Test interactive Python examples — Python 3.11.1 ...
The doctest module searches for pieces of text that look like interactive Python sessions, and then executes those sessions to verify that they...
Read more >
Twisted Documentation: Twisted Coding Standard
The Twisted test suite is spread across many subpackages of the twisted package. Many older tests are in twisted.test . Others can be...
Read more >
Karate | Test Automation Made Simple.
Just write tests in a simple, readable syntax - carefully designed for HTTP, ... method in karate-core is how you refer to the...
Read more >
Python's doctest: Document and Test Your Code at Once
Your doctest tests can live in your project's documentation and your code's docstrings. For example, a package-level docstring containing ...
Read more >
Twisted Coding Standard — Twisted 21.2.0 documentation
Use American spelling in both names and docstrings. ... Twisted's unit tests are written using twisted.trial , an xUnit library which has been...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found