1
0
Fork 0

Test and build docs for user defined apps too

Signed-off-by: Francesco Gazzetta <fgaz@fgaz.me>
This commit is contained in:
Francesco Gazzetta 2021-10-03 19:21:52 +02:00 committed by Daniel Thompson
parent 0eabf0f109
commit b5f4099fa6
3 changed files with 10 additions and 6 deletions

View file

@ -13,6 +13,7 @@
import os import os
import sys import sys
sys.path.insert(0, os.path.abspath('../wasp')) sys.path.insert(0, os.path.abspath('../wasp'))
sys.path.insert(0, os.path.abspath('../apps'))
sys.path.insert(0, os.path.abspath('../wasp/boards/sphinx')) sys.path.insert(0, os.path.abspath('../wasp/boards/sphinx'))

View file

@ -6,9 +6,11 @@ import pytest
def discover_app_constructors(): def discover_app_constructors():
apps = [] apps = []
globs = glob.glob('wasp/apps/*.py') globs_system = glob.glob('wasp/apps/*.py')
names = [ g[5:-3].replace('/', '.') for g in globs ] names_system = [ g[5:-3].replace('/', '.') for g in globs_system ]
modules = [ importlib.import_module(n) for n in names ] globs_user = glob.glob('apps/*.py')
names_user = [ g[:-3].replace('/', '.') for g in globs_user ]
modules = [ importlib.import_module(n) for n in names_system + names_user ]
for m in modules: for m in modules:
for sym in m.__dict__.keys(): for sym in m.__dict__.keys():

View file

@ -3,7 +3,7 @@ import wasp
import importlib import importlib
import os import os
EXCLUDE = ('Notifications', 'Template', 'Faces') EXCLUDE = ('Notifications', 'Template', 'Faces', 'ReadMe')
def test_README(constructor): def test_README(constructor):
if constructor.NAME in EXCLUDE: if constructor.NAME in EXCLUDE:
@ -29,8 +29,9 @@ def test_app_library(constructor):
waspdoc = f.read() waspdoc = f.read()
# Every application must be listed in the Application Library # Every application must be listed in the Application Library
needle = f'.. automodule:: {constructor.__module__}' needle_system = f'.. automodule:: {constructor.__module__}'
assert needle in appdoc needle_user_defined = f'.. automodule:: {constructor.__module__}'.replace('apps.', '')
assert needle_system in appdoc or needle_user_defined in appdoc
def test_docstrings(constructor): def test_docstrings(constructor):
if constructor.NAME in EXCLUDE: if constructor.NAME in EXCLUDE: