2018-04-12 20:04:22 +02:00
|
|
|
import docopt
|
2019-01-22 23:54:25 +01:00
|
|
|
import unittest
|
2018-11-04 19:44:17 +01:00
|
|
|
from lbrynet.extras.daemon.Daemon import Daemon
|
2018-04-12 20:04:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
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))
|