Skip to content

test: simplify consumer tests#565

Merged
AlexanderLanin merged 2 commits into
eclipse-score:mainfrom
etas-contrib:consumer_rewrite
Jun 2, 2026
Merged

test: simplify consumer tests#565
AlexanderLanin merged 2 commits into
eclipse-score:mainfrom
etas-contrib:consumer_rewrite

Conversation

@AlexanderLanin
Copy link
Copy Markdown
Member

@AlexanderLanin AlexanderLanin commented May 28, 2026

Why

The old consumer test was a single monolithic test function that ran all repos and commands sequentially, using os.chdir() to navigate between repo directories. This caused several problems:

  • A single test failure blocked all remaining repos and commands — no partial results.
  • os.chdir() made the working directory a global side-effect, causing subtle failures when commands ran in the wrong directory.
  • Warnings were parsed from captured stderr output with ANSI stripping and logger categorization, but only visible in the log file — not in pytest's summary. The first warning terminated the process immediately, hiding all subsequent ones.
  • The --repo filter option required comma-separated repo names and silently fell back to running all repos on typos, making targeted local runs error-prone.
  • Output was written to consumer_test.log via rich.Console, requiring a separate cat step in CI to surface it. The CI workflow had a summarize job to merge per-repo XML reports and artifacts.
  • test_commands was a separate field from commands, inconsistently populated — only module_template used it, with no tests actually wired up.

What

Parametrized test structure — the single test function is replaced with a @pytest.mark.parametrize test over every combination of (repo, override_type, command). Each combination is now an independent test case that can pass, fail, or be xfailed individually. No more sequential blocking.

No os.chdir() — every subprocess call passes an explicit cwd= argument. The working directory never changes.

local and remote override types as first-class test dimensions — instead of running both override types inside a single test, each is a separate parametrized case. Remote tests check at collection time whether the commit is pushed and fail with a clear reason if not.

Warnings forwarded to pytestWARNING lines are forwarded via warnings.warn() as the process runs; pytest collects them individually in its warnings summary. The process runs to completion before failing.

Plain stdout instead of log file — output goes to print() directly, visible with -s. The consumer_test.log file and the CI artifact upload machinery are removed.

-k replaces --repo — repo and override type filtering uses standard pytest -k syntax, consistent with the rest of the test suite.

Changes

  • src/tests/test_consumer.py — full rewrite: parametrized tests, no os.chdir, local/remote override split, warning forwarding, rich dependency removed, get_current_git_hash from helper_lib used instead of a local reimplementation
  • src/tests/conftest.py--repo option removed; --disable-cache kept
  • .github/workflows/consumer_test.yml — matrix updated to "<repo> and local" / "<repo> and remote" entries passed as -k filter; summarize job and artifact upload removed; --lockfile_mode=error removed from ide_support call
  • .gitignore — added /.codex and /.claude

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: ec0c1353-29e7-4154-b764-7ccc05993364
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: src
WARNING: Target pattern parsing failed.
ERROR: Skipping '//src:license-check': no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
ERROR: no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
INFO: Elapsed time: 5.591s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions
Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@AlexanderLanin AlexanderLanin self-assigned this May 29, 2026
Copy link
Copy Markdown
Contributor

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One important question, (regaridng logging deletion)
Other than that most things look sensible

Comment thread src/tests/test_consumer.py
Comment thread src/tests/test_consumer.py
Comment thread src/tests/test_consumer.py
"""
Consumer tests: verify that downstream repos build successfully against this branch.

Via Python (requires ide_support to have been run first):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: (can be done some other time)

If this is truly a requirement we could just do an assert that .venv_docs exists and otherwise exit early.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add bazel support as well, but thats a separate PR. This was like that forever.

)
assert process.stdout is not None
for line in process.stdout:
print(line, end="")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this on purpose or left over from debugging?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed in future PR's if that is the case.

Copy link
Copy Markdown
Member Author

@AlexanderLanin AlexanderLanin Jun 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that's for pytest with -s mode. As it's run from workflows as well.

Copy link
Copy Markdown
Contributor

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this looks fine.

The two points I commented on are minor and can be removed in a future PR.

With this change we might can look at testing / expanding the tests soon.

@AlexanderLanin AlexanderLanin merged commit 590778c into eclipse-score:main Jun 2, 2026
15 checks passed
@AlexanderLanin AlexanderLanin deleted the consumer_rewrite branch June 2, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants