From a12c37628978facc78a80c466f8d25d1f08bd3ae Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Fri, 23 Jan 2026 16:43:25 +0100 Subject: [PATCH 1/4] Add cleanup to consumer tests to ensure fresh env for each run --- src/tests/test_consumer.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/tests/test_consumer.py b/src/tests/test_consumer.py index a8f8071fb..1fd44a045 100644 --- a/src/tests/test_consumer.py +++ b/src/tests/test_consumer.py @@ -13,6 +13,7 @@ import os import re import subprocess +import shutil from collections import defaultdict from dataclasses import dataclass, field from pathlib import Path @@ -132,6 +133,17 @@ def sphinx_base_dir(tmp_path_factory: TempPathFactory, pytestconfig: Config) -> return CACHE_DIR +def cleanup(): + """ + Cleanup before tests are run + """ + for p in Path(".").glob("*/ubproject.toml"): + p.unlink() + shutil.rmtree("_build", ignore_errors=True) + cmd = "bazel clean --async" + subprocess.run(cmd.split(), text=True) + + def get_current_git_commit(curr_path: Path): """ Get the current git commit hash (HEAD). @@ -449,6 +461,8 @@ def run_cmd( ) -> tuple[list[Result], bool]: verbosity: int = pytestconfig.get_verbosity() + cleanup() + if verbosity >= 3: # Level 3 (-vvv): Stream output in real-time BR = stream_subprocess_output(cmd, repo_name) @@ -584,6 +598,7 @@ def prepare_repo_overrides( # Updated version of your test loop def test_and_clone_repos_updated(sphinx_base_dir: Path, pytestconfig: Config): # Get command line options from pytest config + repo_tests: str | None = cast(str | None, pytestconfig.getoption("--repo")) disable_cache: bool = bool(pytestconfig.getoption("--disable-cache")) From 2ed85eb9ece656a31c9b41efd5c461c9890aacd8 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Fri, 23 Jan 2026 16:56:04 +0100 Subject: [PATCH 2/4] Fix linter --- src/tests/test_consumer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/test_consumer.py b/src/tests/test_consumer.py index 1fd44a045..14adad1b1 100644 --- a/src/tests/test_consumer.py +++ b/src/tests/test_consumer.py @@ -12,8 +12,8 @@ # ******************************************************************************* import os import re -import subprocess import shutil +import subprocess from collections import defaultdict from dataclasses import dataclass, field from pathlib import Path From 8fee5b6ba7067d530697d1986aea0caba5a24cb2 Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Fri, 23 Jan 2026 17:00:51 +0100 Subject: [PATCH 3/4] Enable consumer tests to run on PR instead of main --- .github/workflows/consumer_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/consumer_test.yml b/.github/workflows/consumer_test.yml index f3f41c995..086f85b52 100644 --- a/.github/workflows/consumer_test.yml +++ b/.github/workflows/consumer_test.yml @@ -14,8 +14,8 @@ name: Consumer Tests on: workflow_call: - pull_request_target: - types: [opened, reopened, synchronize] # Allows forks to trigger the docs build + pull_request: + types: [opened, reopened, synchronize] merge_group: types: [checks_requested] From 97d67b92f1bf24a55c4b2bd13832844dd12c87df Mon Sep 17 00:00:00 2001 From: MaximilianSoerenPollak Date: Fri, 23 Jan 2026 17:04:31 +0100 Subject: [PATCH 4/4] Fix formatting --- .github/workflows/consumer_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/consumer_test.yml b/.github/workflows/consumer_test.yml index 086f85b52..15b154785 100644 --- a/.github/workflows/consumer_test.yml +++ b/.github/workflows/consumer_test.yml @@ -15,7 +15,7 @@ name: Consumer Tests on: workflow_call: pull_request: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize] merge_group: types: [checks_requested]