[PATCH] doc: Use sys.path.append for pytests being found
Tom Rini
trini at konsulko.com
Mon Mar 9 19:09:52 CET 2026
Rather than having our "docs" build tagets modify PTYHONPATH, have
doc/conf.py append the required paths at runtime instead. This will
ensure that our builds from readthedocs will also find all of the
required files.
Signed-off-by: Tom Rini <trini at konsulko.com>
---
Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
Currently this is empy for example:
https://docs.u-boot.org/en/latest/develop/pytest/test_bind.html
But with these changes:
https://u-boot--903.org.readthedocs.build/en/903/develop/pytest/test_bind.html
---
Makefile | 3 +--
doc/conf.py | 2 ++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 5df869213b63..88543808ff58 100644
--- a/Makefile
+++ b/Makefile
@@ -2759,8 +2759,7 @@ DOC_TARGETS := xmldocs latexdocs pdfdocs htmldocs epubdocs cleandocs \
linkcheckdocs dochelp refcheckdocs texinfodocs infodocs
PHONY += $(DOC_TARGETS)
$(DOC_TARGETS): scripts_basic FORCE
- $(Q)PYTHONPATH=$(srctree)/test/py/tests:$(srctree)/test/py \
- $(MAKE) $(build)=doc $@
+ $(Q)$(MAKE) $(build)=doc $@
PHONY += checkstack ubootrelease ubootversion
diff --git a/doc/conf.py b/doc/conf.py
index 84d028feda83..bf60fe14315a 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -34,6 +34,8 @@ if os.environ.get("READTHEDOCS", "") == "True":
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('sphinx'))
+sys.path.append(os.path.abspath('../test/py/tests'))
+sys.path.append(os.path.abspath('../test/py'))
from load_config import loadConfig
# -- General configuration ------------------------------------------------
--
2.43.0
More information about the U-Boot
mailing list