2018-04-12 20:04:22 +02:00
|
|
|
import docopt
|
|
|
|
from twisted.trial import unittest
|
|
|
|
from lbrynet.daemon.Daemon import Daemon
|
|
|
|
|
|
|
|
|
|
|
|
class DaemonDocsTests(unittest.TestCase):
|
|
|
|
def test_can_parse_api_method_docs(self):
|
|
|
|
failures = []
|
2018-07-21 23:11:44 +02:00
|
|
|
for name, fn in Daemon.callable_methods.items():
|
2018-04-12 20:04:22 +02:00
|
|
|
try:
|
|
|
|
docopt.docopt(fn.__doc__, ())
|
|
|
|
except docopt.DocoptLanguageError as err:
|
2018-10-18 12:42:45 +02:00
|
|
|
failures.append(f"invalid docstring for {name}, {err.message}")
|
2018-04-12 20:04:22 +02:00
|
|
|
except docopt.DocoptExit:
|
|
|
|
pass
|
|
|
|
if failures:
|
|
|
|
self.fail("\n" + "\n".join(failures))
|