Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/consumer_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
15 changes: 15 additions & 0 deletions src/tests/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# *******************************************************************************
import os
import re
import shutil
import subprocess
from collections import defaultdict
from dataclasses import dataclass, field
Expand Down Expand Up @@ -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).
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"))

Expand Down
Loading