From b5f4099fa6f2eb43de847aed673d0d9a29ef726f Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sun, 3 Oct 2021 19:21:52 +0200 Subject: [PATCH] Test and build docs for user defined apps too Signed-off-by: Francesco Gazzetta --- docs/conf.py | 1 + wasp/boards/simulator/conftest.py | 8 +++++--- wasp/boards/simulator/test_qa.py | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 146b040..25edb59 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -13,6 +13,7 @@ import os import sys 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')) diff --git a/wasp/boards/simulator/conftest.py b/wasp/boards/simulator/conftest.py index ffd2344..29f8206 100644 --- a/wasp/boards/simulator/conftest.py +++ b/wasp/boards/simulator/conftest.py @@ -6,9 +6,11 @@ import pytest def discover_app_constructors(): apps = [] - globs = glob.glob('wasp/apps/*.py') - names = [ g[5:-3].replace('/', '.') for g in globs ] - modules = [ importlib.import_module(n) for n in names ] + globs_system = glob.glob('wasp/apps/*.py') + names_system = [ g[5:-3].replace('/', '.') for g in globs_system ] + 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 sym in m.__dict__.keys(): diff --git a/wasp/boards/simulator/test_qa.py b/wasp/boards/simulator/test_qa.py index 04dab15..f15b853 100644 --- a/wasp/boards/simulator/test_qa.py +++ b/wasp/boards/simulator/test_qa.py @@ -3,7 +3,7 @@ import wasp import importlib import os -EXCLUDE = ('Notifications', 'Template', 'Faces') +EXCLUDE = ('Notifications', 'Template', 'Faces', 'ReadMe') def test_README(constructor): if constructor.NAME in EXCLUDE: @@ -29,8 +29,9 @@ def test_app_library(constructor): waspdoc = f.read() # Every application must be listed in the Application Library - needle = f'.. automodule:: {constructor.__module__}' - assert needle in appdoc + needle_system = f'.. automodule:: {constructor.__module__}' + needle_user_defined = f'.. automodule:: {constructor.__module__}'.replace('apps.', '') + assert needle_system in appdoc or needle_user_defined in appdoc def test_docstrings(constructor): if constructor.NAME in EXCLUDE: