From 04d5edc1db4cea2514766461a5fc023a0d23ff38 Mon Sep 17 00:00:00 2001 From: Gianfranco Costamagna Date: Mon, 23 Nov 2026 09:50:45 +0100 Subject: [PATCH] tests and out of source builds: Include CSS test inputs and support out-of-source builds The source distribution excluded the CSS sources, tests, and generator tools, even though the CSS tests need all three to validate the generated stylesheet. Keep these directories in the sdist so downstream build systems can run the tests from their copied build tree. . The CSS test now searches its parent directories for the source root containing tools/generate_css.py. This lets out-of-source test runs use the generator and compiled stylesheet from the source tree instead of assuming they are beside the copied test files. --- pyproject.toml | 3 --- tests/test_css.py | 10 +++++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c68de04..22e8a52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -71,9 +71,6 @@ ruff = ["ruff==0.17.4"] [tool.flit.sdist] exclude = [ "docs/", - "style/", - "tests/", - "tools/", ] [tool.ruff.lint] diff --git a/tests/test_css.py b/tests/test_css.py index 042e133..8767f7c 100644 --- a/tests/test_css.py +++ b/tests/test_css.py @@ -22,7 +22,15 @@ import pytest -REPO_ROOT = Path(__file__).resolve().parent.parent +TEST_ROOT = Path(__file__).resolve().parent.parent +REPO_ROOT = next( + ( + parent + for parent in (TEST_ROOT, *TEST_ROOT.parents) + if (parent / "tools" / "generate_css.py").is_file() + ), + TEST_ROOT, +) TOOLS_DIR = REPO_ROOT / "tools" ARTIFACT = REPO_ROOT / "sphinx_design" / "static" / "sphinx-design.min.css"