mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2026-11-25 15:06:20 +01:00
The single test job ran all tests one after the other on one runner,
including the Sphinx build and the Docker checks (11-19 min). It is now
split so that every test still runs exactly once:
- docs-test, docker-test: the Sphinx build (new marker "docs") and the
Docker / Home Assistant add-on checks ("docker") in jobs of their own.
- test-server: the tests that start EOS or EOSdash on the fixed ports.
The collection hook marks every test that uses the xprocess fixture
with "eos_server" and puts them into one xdist group, so
"pytest -n auto --dist loadgroup" also works locally. A test that
binds the ports without a fixture carries the marker itself.
- test-shard: all other tests in four shards of about equal runtime
(scripts/shard_test_files.py, runtimes in scripts/test_durations.json),
each with pytest-xdist.
- test-count: fails if these parts do not add up to the tests of one
plain run.
- test: keeps the name of the required check. It prints the combined
coverage report and fails if any of the jobs above failed.
COVERAGE_CORE=sysmon measures line coverage through sys.monitoring:
the report is the same, the test time drops by about a third. The
combined report misses 1-3 statements more than a single run, in lines
that only run when a test finds state left by an earlier test.
The Sphinx build spent 74 % of its time in one search of
PythonDomain.find_obj (sphinx-doc/sphinx#11282). The local extension
docs/_ext/pyxrefindex.py answers it from an index of name endings with
the same matches in the same order; a build has a byte-identical
objects.inv. It copies the logic of Sphinx 9.0.4 and is only active for
that version; TestPyXrefIndex compares it with the installed Sphinx and
fails after a Sphinx update until the version is raised. The
documentation test builds with -j (up to four jobs); its pages can
differ from a serial build in the target of ambiguous cross-references.
Read the Docs builds without -j. Sphinx build on GitHub runners:
427-480 s -> 180-233 s.
make test-ci runs the commands of these jobs one after the other.
On GitHub runners the tests are done after about 2 minutes; the
required check ends with docs-test after about 4-5 minutes.
Additional changes
Add pytest-xdist to the development dependencies
List the 25 slowest tests in each test job (--durations=25)
Test version() directly; it was covered only through the Sphinx test
Add a "Keep Tests Fast" tip, the server marker rule, the extension and
test-ci to the development guide and the testing skill
Refs #1553
Co-authored-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: SchaafAlexander <86607129+SchaafAlexander@users.noreply.github.com>
Assisted-by: Claude Code (claude-opus-5-5)
Assisted-by: Claude Code (claude-fable-5-2)
156 lines
4.7 KiB
Python
156 lines
4.7 KiB
Python
"""Configuration file for the Sphinx documentation builder.
|
|
|
|
For the full list of built-in configuration values, see the documentation:
|
|
https://www.sphinx-doc.org/en/master/usage/configuration.html
|
|
"""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add the src directory to sys.path so Sphinx can import akkudoktoreos
|
|
PROJECT_ROOT = Path(__file__).parent.parent
|
|
SRC_DIR = PROJECT_ROOT / "src"
|
|
sys.path.insert(0, str(SRC_DIR))
|
|
# Local Sphinx extensions
|
|
sys.path.insert(0, str(Path(__file__).parent / "_ext"))
|
|
|
|
# Tell akkudoktoreos that it is imported for the documentation build
|
|
# (see ConfigEOS.documentation_mode()).
|
|
sys._called_from_sphinx = True # type: ignore[attr-defined]
|
|
|
|
from akkudoktoreos.core.version import __version__
|
|
|
|
# -- Project information -----------------------------------------------------
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
|
|
|
|
project = "Akkudoktor EOS"
|
|
copyright = "2025..2026, Andreas Schmitz"
|
|
author = "Andreas Schmitz"
|
|
release = __version__
|
|
|
|
# -- General configuration ---------------------------------------------------
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
|
|
|
extensions = [
|
|
"sphinx.ext.autodoc",
|
|
"sphinx.ext.autosummary",
|
|
"sphinx.ext.napoleon",
|
|
"sphinx.ext.todo",
|
|
"sphinx_rtd_theme",
|
|
"myst_parser",
|
|
"sphinx_tabs.tabs",
|
|
"sphinxcontrib.mermaid",
|
|
"pyxrefindex", # faster Python cross-reference search, see docs/_ext/pyxrefindex.py
|
|
]
|
|
|
|
templates_path = ["_templates"]
|
|
# docs/agents/ holds instructions for coding agents, not user documentation.
|
|
exclude_patterns = ["agents/**"]
|
|
|
|
source_suffix = {
|
|
".rst": "restructuredtext",
|
|
".txt": "markdown",
|
|
".md": "markdown",
|
|
}
|
|
|
|
# -- Options for Myst Markdown -----------------------------------------------
|
|
# see https://github.com/executablebooks/MyST-Parser/blob/master/docs/conf.py
|
|
|
|
myst_enable_extensions = [
|
|
"dollarmath",
|
|
"amsmath",
|
|
"deflist",
|
|
"fieldlist",
|
|
"html_admonition",
|
|
"html_image",
|
|
"colon_fence",
|
|
"smartquotes",
|
|
"replacements",
|
|
"linkify",
|
|
"strikethrough",
|
|
"substitution",
|
|
"tasklist",
|
|
"attrs_inline",
|
|
"attrs_block",
|
|
]
|
|
myst_url_schemes = {
|
|
"http": None,
|
|
"https": None,
|
|
"mailto": None,
|
|
"ftp": None,
|
|
"wiki": "https://en.wikipedia.org/wiki/{{path}}#{{fragment}}",
|
|
"doi": "https://doi.org/{{path}}",
|
|
"gh-pr": {
|
|
"url": "https://github.com/Akkudoktor-EOS/EOS/pull/{{path}}#{{fragment}}",
|
|
"title": "PR #{{path}}",
|
|
"classes": ["github"],
|
|
},
|
|
"gh-issue": {
|
|
"url": "https://github.com/Akkudoktor-EOS/EOS/issue/{{path}}#{{fragment}}",
|
|
"title": "Issue #{{path}}",
|
|
"classes": ["github"],
|
|
},
|
|
"gh-user": {
|
|
"url": "https://github.com/{{path}}",
|
|
"title": "@{{path}}",
|
|
"classes": ["github"],
|
|
},
|
|
}
|
|
myst_number_code_blocks = ["typescript"]
|
|
myst_heading_anchors = 3
|
|
myst_footnote_transition = True
|
|
myst_dmath_double_inline = True
|
|
myst_enable_checkboxes = True
|
|
myst_substitutions = {
|
|
"role": "[role](#syntax/roles)",
|
|
"directive": "[directive](#syntax/directives)",
|
|
}
|
|
|
|
# -- Options for HTML output -------------------------------------------------
|
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
|
|
|
|
html_theme = "sphinx_rtd_theme"
|
|
html_static_path = ["_static"]
|
|
html_logo = "_static/logo.png"
|
|
html_theme_options = {
|
|
"logo_only": False,
|
|
"titles_only": True,
|
|
}
|
|
html_css_files = ["eos.css"] # Make body size wider
|
|
|
|
# -- Options for autodoc -------------------------------------------------
|
|
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html
|
|
|
|
# Make source file directories available to sphinx
|
|
sys.path.insert(0, str(Path("..", "src").resolve()))
|
|
|
|
autodoc_default_options = {
|
|
"members": "var1, var2",
|
|
"member-order": "bysource",
|
|
"special-members": "__init__",
|
|
"undoc-members": True,
|
|
"exclude-members": "__weakref__",
|
|
}
|
|
|
|
# -- Options for autosummary -------------------------------------------------
|
|
autosummary_generate = True
|
|
|
|
# -- Options for napoleon -------------------------------------------------
|
|
napoleon_google_docstring = True
|
|
napoleon_numpy_docstring = False
|
|
napoleon_include_init_with_doc = False
|
|
napoleon_include_private_with_doc = False
|
|
napoleon_include_special_with_doc = True
|
|
napoleon_use_admonition_for_examples = False
|
|
napoleon_use_admonition_for_notes = False
|
|
napoleon_use_admonition_for_references = False
|
|
napoleon_use_ivar = False
|
|
napoleon_use_param = True
|
|
napoleon_use_rtype = True
|
|
napoleon_preprocess_types = False
|
|
napoleon_type_aliases = None
|
|
napoleon_attr_annotations = True
|
|
|
|
# -- Options for mermaid -------------------------------------------------
|
|
mermaid_output_format = "html" # no mmdc to be installed
|