aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-09-23 17:54:00 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-10-01 15:32:20 +0300
commit5401be5d7ed3969b4e5a64a61f0ebbba3394ecd5 (patch)
tree85f3244e263443ddf3445da98d9956ebba43e260 /tests
parentchecks/test_metadata.py: fix stable tests order (diff)
downloadpkgcheck-5401be5d7ed3969b4e5a64a61f0ebbba3394ecd5.tar.gz
pkgcheck-5401be5d7ed3969b4e5a64a61f0ebbba3394ecd5.tar.bz2
pkgcheck-5401be5d7ed3969b4e5a64a61f0ebbba3394ecd5.zip
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/conftest.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index b27b7f1c..675110a6 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -6,12 +6,14 @@ from pathlib import Path
from unittest.mock import patch
import pytest
+from pkgcheck.addons.git import GitConfig
from pkgcheck.cli import Tool
from pkgcheck.reporters import StrReporter
from pkgcheck.results import Result
from pkgcheck.scripts import pkgcheck
from pkgcore import const as pkgcore_const
from snakeoil.cli.arghparse import ArgumentParser
+from snakeoil.contexts import os_environ
from snakeoil.formatters import PlainTextFormatter
from snakeoil.osutils import pjoin
@@ -42,9 +44,11 @@ def default_session_fixture(request):
stack = ExitStack()
# don't load the default system or user config files
stack.enter_context(patch('pkgcheck.cli.ConfigFileParser.default_configs', ()))
+ stack.enter_context(os_environ(**(git_config := GitConfig()).config_env))
def unpatch():
stack.close()
+ git_config.close()
request.addfinalizer(unpatch)