From: Tamir Duberstein <tamird@kernel.org>
To: "Kernel.org Tools" <tools@kernel.org>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
Tamir Duberstein <tamird@kernel.org>
Subject: [PATCH b4 05/12] Fix tests under uv with complex git config
Date: Tue, 07 Apr 2026 12:48:34 -0400 [thread overview]
Message-ID: <20260407-ruff-check-v1-5-c9568541ff67@kernel.org> (raw)
In-Reply-To: <20260407-ruff-check-v1-0-c9568541ff67@kernel.org>
Add pytest-asyncio to the dev group so pytest can run async TUI
tests.
Pin git-filter-repo to unreleased commit 4697eeb for the multiline
git config parser fix requested in
https://github.com/newren/git-filter-repo/issues/638.
That parser fix is the only functional change since v2.47.0:
https://github.com/newren/git-filter-repo/compare/v2.47.0...4697eeb37b7c3c30b0492e344f6b89f7139cef26
Inject commit.gpgsign=false through the test fixture so synthetic git
commits do not hang on local GPG/pinentry configuration. Also disable
attestation through MAIN_CONFIG so tests keep the old can_patatt=false
behavior after patatt becomes an unconditional dependency.
As a drive-by, route the test b4 globals, pytest sentinel, and XDG
env overrides through monkeypatch so each test gets automatic
cleanup.
Signed-off-by: Tamir Duberstein <tamird@kernel.org>
---
pyproject.toml | 4 +++-
src/tests/conftest.py | 39 +++++++++++++++++++++++++++++----------
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 4fad7da..8428c5b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -24,7 +24,9 @@ classifiers = [
]
dependencies = [
"requests>=2.24,<3.0",
- "git-filter-repo>=2.30,<3.0",
+ # Use unreleased fix for multiline git config values.
+ # https://github.com/newren/git-filter-repo/issues/638
+ "git-filter-repo @ git+https://github.com/newren/git-filter-repo.git@4697eeb37b7c3c30b0492e344f6b89f7139cef26",
"dkimpy>=1.0,<2.0",
"patatt>=0.6,<2.0",
"ezgb>=0.1",
diff --git a/src/tests/conftest.py b/src/tests/conftest.py
index 3ff3891..83b467d 100644
--- a/src/tests/conftest.py
+++ b/src/tests/conftest.py
@@ -1,3 +1,4 @@
+import copy
import os
import pathlib
import sys
@@ -9,20 +10,38 @@ import b4
@pytest.fixture(scope="function", autouse=True)
-def settestdefaults(tmp_path: pathlib.Path) -> None:
+def settestdefaults(
+ monkeypatch: pytest.MonkeyPatch,
+ tmp_path: pathlib.Path,
+) -> None:
topdir = b4.git_get_toplevel()
if topdir and topdir != os.getcwd():
os.chdir(topdir)
- b4.can_network = False
- b4.MAIN_CONFIG = dict(b4.DEFAULT_CONFIG)
- b4.USER_CONFIG = {
- 'name': 'Test Override',
- 'email': 'test-override@example.com',
- }
- os.environ['XDG_DATA_HOME'] = str(tmp_path)
- os.environ['XDG_CACHE_HOME'] = str(tmp_path)
+ monkeypatch.setattr(b4, 'can_network', False)
+ monkeypatch.setattr(
+ b4,
+ 'MAIN_CONFIG',
+ {
+ **copy.deepcopy(b4.DEFAULT_CONFIG),
+ 'attestation-policy': 'off',
+ },
+ )
+ monkeypatch.setattr(
+ b4,
+ 'USER_CONFIG',
+ {
+ 'name': 'Test Override',
+ 'email': 'test-override@example.com',
+ },
+ )
+ monkeypatch.setenv('XDG_DATA_HOME', str(tmp_path))
+ monkeypatch.setenv('XDG_CACHE_HOME', str(tmp_path))
+ git_config_count = int(os.environ.get('GIT_CONFIG_COUNT', '0'))
+ monkeypatch.setenv('GIT_CONFIG_COUNT', str(git_config_count + 1))
+ monkeypatch.setenv(f'GIT_CONFIG_KEY_{git_config_count}', 'commit.gpgsign')
+ monkeypatch.setenv(f'GIT_CONFIG_VALUE_{git_config_count}', 'false')
# This lets us avoid execvp-ing from inside b4 when testing
- sys._running_in_pytest = True # type: ignore[attr-defined]
+ monkeypatch.setattr(sys, '_running_in_pytest', True, raising=False)
@pytest.fixture(scope="function")
--
2.53.0
next prev parent reply other threads:[~2026-04-07 16:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 16:48 [PATCH b4 00/12] Enable stricter local checks Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 01/12] Configure ruff format with single quotes Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 02/12] Fix ruff check warnings Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 03/12] Use ruff to sort imports Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 04/12] Import dependencies unconditionally Tamir Duberstein
2026-04-07 16:48 ` Tamir Duberstein [this message]
2026-04-07 16:48 ` [PATCH b4 06/12] Fix typings in misc/ Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 07/12] Enable mypy unreachable warnings Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 08/12] Enable and fix pyright diagnostics Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 09/12] Avoid duplicate map lookups Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 10/12] Add ty and configuration Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 11/12] Enable pyright strict mode Tamir Duberstein
2026-04-07 16:48 ` [PATCH b4 12/12] Add local CI review check Tamir Duberstein
2026-04-10 15:05 ` [PATCH b4 00/12] Enable stricter local checks Tamir Duberstein
2026-04-10 15:21 ` Konstantin Ryabitsev
2026-04-10 22:39 ` Tamir Duberstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260407-ruff-check-v1-5-c9568541ff67@kernel.org \
--to=tamird@kernel.org \
--cc=konstantin@linuxfoundation.org \
--cc=tools@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox