Skip to content

Conversation

@GideonBear
Copy link

@GideonBear GideonBear commented Dec 28, 2025

This fixes running tests when git config --global commit.gpgsign true:

error: gpg failed to sign the data:
gpg: skipped "test <[email protected]>": No secret key
[GNUPG:] INV_SGNR 9 test <[email protected]>
[GNUPG:] FAILURE sign 17
gpg: signing failed: No secret key

fatal: failed to write commit object

With this patch, the tests pass.
Other scenarios where the global config could cause problems in tests are thinkable as well. The tests should not rely on or use the global config at all.
Alternatively, we could do the following (which also works):

diff --git a/tests/make_repo_test.py b/tests/make_repo_test.py
index e874ef6..8ed7598 100644
--- a/tests/make_repo_test.py
+++ b/tests/make_repo_test.py
@@ -46,6 +46,7 @@ def in_git_dir(tmpdir):
     git_path = tmpdir.join('gits')
     subprocess.check_call(('git', 'init', git_path))
     with git_path.as_cwd():
+        subprocess.check_call(('git', 'config', 'commit.gpgsign', 'false'))
         yield git_path

But that seems like a worse solution.

@GideonBear GideonBear changed the title Ignore global config in tests Ignore global git config in tests Dec 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant