[PATCH 2 of 2 stable v2] tests: prevent Git system and global configuration from loading

Manuel Jacob me at manueljacob.de
Tue Apr 18 18:35:56 UTC 2023


# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1680139355 -7200
#      Thu Mar 30 03:22:35 2023 +0200
# Branch stable
# Node ID e5251abd0a3c677d7bb0828f3a744789bd6fe4cb
# Parent  30082bb9719eb00f3be0081b7221d7c3061d4345
# EXP-Topic tests-git
tests: prevent Git system and global configuration from loading

This reduces differences between different testing environments. Something
similar is already done for Mercurial (in the lines directly above this
change).

The parent changeset has originally been added to support user.useconfigonly.
With this changeset, the original motivation for it becomes obsolete. However,
it is still necessary to set the committer name via a environment variable, at
least on my machine.

diff --git a/kallithea/tests/other/test_vcs_operations.py b/kallithea/tests/other/test_vcs_operations.py
--- a/kallithea/tests/other/test_vcs_operations.py
+++ b/kallithea/tests/other/test_vcs_operations.py
@@ -150,6 +150,8 @@
         testenv['LANGUAGE'] = 'en_US:en'
         testenv['HGPLAIN'] = ''
         testenv['HGRCPATH'] = ''
+        testenv['GIT_CONFIG_SYSTEM'] = ''
+        testenv['GIT_CONFIG_GLOBAL'] = ''
         testenv.update(environ)
         p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd, env=testenv)
         stdout, stderr = p.communicate()
@@ -181,9 +183,6 @@
         '"%s"' % message,
         *extra_args,
         HGUSER='%s <%s>' % (name, email),
-        # If the user.useconfigonly config is set, Git won't try to auto-detect
-        # the name and email. For this case, we need to pass them as
-        # environment variables.
         GIT_AUTHOR_NAME=name,
         GIT_AUTHOR_EMAIL=email,
         GIT_COMMITTER_NAME=name,



More information about the kallithea-general mailing list