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

Manuel Jacob me at manueljacob.de
Sat Apr 1 08:20:32 UTC 2023


On 31/03/2023 20.45, Mads Kiilerich wrote:
> On 30/03/2023 03:37, Manuel Jacob wrote:
>> # HG changeset patch
>> # User Manuel Jacob <me at manueljacob.de>
>> # Date 1680139355 -7200
>> #      Thu Mar 30 03:22:35 2023 +0200
>> # Node ID 4933600c49883dfc142f97a32dd08f9dd82b0d31
>> # Parent  2304f8da62b03f6cfd966b72eec70c38c4d52e37
>> # 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'] = ''
> 
> 
> Looking at the git man page, I wonder why not using /dev/null?

The path /dev/null is specific to some operating systems. While these 
might be all systems the tests can factually be run on, it didn’t seem 
quite right to me. I agree that passing an empty string is a bit too 
implicit. I think that both ways aren’t perfect. I don’t have a strong 
opinion really, so feel free to commit it any way you like more.

> (I don't like how Mercurial put different semantics to undefined and 
> empty environment variables. That used to cause problems on some 
> almost-extinct unices. But it seems to work...)
> 
> 
> /Mads
> 
> 
>>           testenv.update(environ)
>>           p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, 
>> cwd=self.cwd, env=testenv)
>>           stdout, stderr = p.communicate()
>>
>> _______________________________________________
>> kallithea-general mailing list
>> kallithea-general at sfconservancy.org
>> https://lists.sfconservancy.org/mailman/listinfo/kallithea-general
> 
> 



More information about the kallithea-general mailing list