Changeset - 511b20a6475d
[Not reviewed]
stable
0 1 0
Manuel Jacob - 3 years ago 2023-03-30 03:22:35
me@manueljacob.de
Grafted from: 9c77f08ca7d8
tests: skip reading Git system and global configuration in test_vcs_operations

The parent changeset reduced the dependency on global configuration and made it
possible to run tests without any global git configuration. But it is still
unfortunate to even look at the global configuration when running tests.

Global configuration is already disabled for Mercurial by setting HGRCPATH.

Now do something similar for Git. According to the git man page,
GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM set to /dev/null will make Git skip
reading the configuration files on all platforms.

Note that the GIT_CONFIG variables were introduced in Git 2.32.0, so this will
not work with all the Git versions supported by Kallithea.
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/other/test_vcs_operations.py
Show inline comments
 
@@ -147,12 +147,14 @@ class Command(object):
 
            print('*** CMD %s ***' % command)
 
        testenv = dict(os.environ)
 
        testenv['LANG'] = 'en_US.UTF-8'
 
        testenv['LANGUAGE'] = 'en_US:en'
 
        testenv['HGPLAIN'] = ''
 
        testenv['HGRCPATH'] = ''
 
        testenv['GIT_CONFIG_SYSTEM'] = '/dev/null'
 
        testenv['GIT_CONFIG_GLOBAL'] = '/dev/null'
 
        testenv['GIT_COMMITTER_NAME'] = base.TEST_USER_ADMIN_LOGIN
 
        testenv['GIT_COMMITTER_EMAIL'] = base.TEST_USER_ADMIN_EMAIL
 
        testenv['GIT_AUTHOR_NAME'] = base.TEST_USER_REGULAR_LOGIN
 
        testenv['GIT_AUTHOR_EMAIL'] = base.TEST_USER_REGULAR_EMAIL
 
        testenv.update(environ)
 
        p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd, env=testenv)
0 comments (0 inline, 0 general)