test: simplify consumer tests#565
Open
AlexanderLanin wants to merge 1 commit into
Open
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
de74a49 to
278e2a8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:os.chdir()made the working directory a global side-effect, causing subtle failures when commands ran in the wrong directory.--repofilter option required comma-separated repo names and silently fell back to running all repos on typos, making targeted local runs error-prone.consumer_test.logviarich.Console, requiring a separatecatstep in CI to surface it. The CI workflow had asummarizejob to merge per-repo XML reports and artifacts.test_commandswas a separate field fromcommands, inconsistently populated — onlymodule_templateused it, with no tests actually wired up.What
Parametrized test structure — the single test function is replaced with a
@pytest.mark.parametrizetest 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 explicitcwd=argument. The working directory never changes.localandremoteoverride 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 pytest —
WARNINGlines are forwarded viawarnings.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. Theconsumer_test.logfile and the CI artifact upload machinery are removed.-kreplaces--repo— repo and override type filtering uses standard pytest-ksyntax, consistent with the rest of the test suite.Changes
src/tests/test_consumer.py— full rewrite: parametrized tests, noos.chdir,local/remoteoverride split, warning forwarding,richdependency removed,get_current_git_hashfrom helper_lib used instead of a local reimplementationsrc/tests/conftest.py—--repooption removed;--disable-cachekept.github/workflows/consumer_test.yml— matrix updated to"<repo> and local"/"<repo> and remote"entries passed as-kfilter;summarizejob and artifact upload removed;--lockfile_mode=errorremoved fromide_supportcall.gitignore— added/.codexand/.claude