Skip to content

Commit 5401be5

Browse files
committed
tests: suppress user and system gitconfig
- Makes testing on local machines much faster, as it ignores the user's signing key and other settings. - Makes locale issues less likely to cause test failures. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 6ef8b72 commit 5401be5

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from unittest.mock import patch
77

88
import pytest
9+
from pkgcheck.addons.git import GitConfig
910
from pkgcheck.cli import Tool
1011
from pkgcheck.reporters import StrReporter
1112
from pkgcheck.results import Result
1213
from pkgcheck.scripts import pkgcheck
1314
from pkgcore import const as pkgcore_const
1415
from snakeoil.cli.arghparse import ArgumentParser
16+
from snakeoil.contexts import os_environ
1517
from snakeoil.formatters import PlainTextFormatter
1618
from snakeoil.osutils import pjoin
1719

@@ -42,9 +44,11 @@ def default_session_fixture(request):
4244
stack = ExitStack()
4345
# don't load the default system or user config files
4446
stack.enter_context(patch('pkgcheck.cli.ConfigFileParser.default_configs', ()))
47+
stack.enter_context(os_environ(**(git_config := GitConfig()).config_env))
4548

4649
def unpatch():
4750
stack.close()
51+
git_config.close()
4852

4953
request.addfinalizer(unpatch)
5054

0 commit comments

Comments
 (0)