Repository navigation
fix(tests): a commit in a test no longer needs a git identity from the machine - #1070
Merged
Merged
Conversation
…e machine Push runs of ci.yml on main have been red since they moved to GitHub-hosted runners: the user there has no name, so six tests that commit to scratch repositories failed with "Author identity unknown". A session fixture now points GIT_CONFIG_GLOBAL at a config of the tests' own, so no test reads the global git config of the machine it runs on. A test that sets GIT_CONFIG_GLOBAL itself still wins, and so do repository config and `-c`. Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 2 selected item(s). CI at Review details
|
napetrov
approved these changes
Nov 21, 2026
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1070 +/- ##
==========================================
- Coverage 95.92% 95.91% -0.01%
==========================================
Files 449 449
Lines 59468 59472 +4
Branches 10252 10253 +1
==========================================
+ Hits 57042 57043 +1
+ Misses 1508 1507 -1
- Partials 918 922 +4 🚀 New features to boost your workflow:
|
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.
Summary
Push runs of
ci.ymlonmainhave been red since #1043 moved them to GitHub-hostedubuntu-latest: six tests fail withAuthor identity unknown(fatal: empty ident name ... not allowed), intests/test_repo_guidance_history.py(4) andtests/test_repo_run_cache_paths_usable.py(2). The user of a hosted runner has no name, and those tests commit to scratch repositories using whatever git identity the machine happens to have. Pull requests stay green because their jobs run ondokimi-ec2, which has one.The tests were not independent of the machine. 69 test files run
git commitorgit merge, and they give git an identity in four different ways (-c user.name=per call,GIT_AUTHOR_*variables,git config,GIT_CONFIG_GLOBAL); a test that does none of them passes only where the global config supplies one.ci/test.pyalready sets a config of its own for the Intel CI path, for this reason.A session fixture in
tests/conftest.pynow pointsGIT_CONFIG_GLOBALat a temporary config that holds an identity, so no test reads the global git config of the machine. A test that setsGIT_CONFIG_GLOBALitself, a repository's own config and-cstill win over it.Rejected: a
git config --globalstep in the workflow. It fixes one runner and leaves the tests depending on the machine, so a contributor with no identity, or a global config withcommit.gpgsign=true, gets the same failures.mainalso fails two help-text tests on Python 3.11 and 3.12 for an unrelated reason; that is #1069.Changes
tests/conftest.py: the session fixture_git_config_of_the_session(autouse).tests/test_git_identity.py: two tests.git config --global --listshows only the session's identity, which fails on any machine without the fixture; a commit succeeds withuser.useConfigOnly=trueand no identity variables, which is how a user the system has no name for behaves.Testing
On Python 3.13, with a hosted-runner-like environment (empty
HOME, no system config,user.useConfigOnly=true, no identity variables):test_repo_guidance_history.pyandtest_repo_run_cache_paths_usable.pyonmain: 6 failed, the six above. With this change: 86 passed (84 plus the two new tests).commit.gpgsign=true: the same files fail onmainand pass with this change.main7 failed, this change 1 failed; no test fails only with this change. The remaining failure is the same onmainand is specific to the machine the suite ran on.ci.ymlrun byworkflow_dispatchon this branch in a fork, where every job runs onubuntu-latest(the tree is the same as this commit's; only its message was reworded since): Tests on Python 3.13, 3.14 and with the latest dependencies pass, which includes the six tests above, and so do mypy, Static checks, Windows smoke, Fidelity golden and both package smoke tests. Tests on 3.11 and 3.12 fail onlytest_help_shows_the_registry_metavar_not_the_old_nameoftest_cli_f1b_reps.py(repo runandeval check), which fails the same way onmainand has its own fix in test(cli): the concurrency help check passes on Python before 3.13 #1069.The checks of this pull request run on
dokimi-ec2, which has an identity, so they cannot show the hosted-runner result; the first push run onmainafter the merge does.Revert
Revert the commit. Nothing outside
tests/changes.Checklist
pytestpassesruff,mypy, and schema checks pass (CI)AGENTS.md.github/.licenserc.yaml)