test_ez.py: xfail tests that need unreleased git_filter_repo fix
PATCH 1/1 test_ez.py: xfail tests that need unreleased git_filter_repo fix
Mark tests that need the unreleased, multi-lines git_filter_repo fix with pytest.mark.xfail(). Blowing up the test suite out of the box is not a welcoming development experience.
Show how to switch to any other, random git_filter_repo version with a one character change in pyproject.toml.
Make sure pytest.mark.xfail() is off when testing git_filter_repo versions other than the latest, broken one that everyone uses by default.
Signed-off-by Marc Herbert <[email protected]>
--- pyproject.toml | 4 ++++ src/tests/test_ez.py | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-)
pyproject.toml +4 -0
@@ -25,6 +25,10 @@ classifiers = [ dependencies = [ "requests>=2.24,<3.0", "git-filter-repo>=2.30,<3.0", + # Use something like this instead to test multi-line fix 4697eeb37b7c3c30b in 2.48 not + # released yet. See + # https://lore.kernel.org/tools/[email protected]/ + # "git-filter-repo@git+https://github.com/newren/git-filter-repo#c1d8461ee34c6d3f", "dkimpy>=1.0,<2.0", "patatt>=0.6,<2.0", ]
src/tests/test_ez.py +25 -3
@@ -7,6 +7,10 @@ import b4.command from typing import Any, Dict, Generator, List, Optional, Tuple +# For xfail_multi_lines() / git_filter_repo 2.47.0 bug +import git_filter_repo +from contextlib import redirect_stdout +from io import StringIO @pytest.fixture(scope="function") def prepdir(gitdir: str) -> Generator[str, None, None]:
@@ -18,11 +22,29 @@ def prepdir(gitdir: str) -> Generator[str, None, None]: yield gitdir +_out = StringIO() +with redirect_stdout(_out): + git_filter_repo.GitUtils.print_my_version() +git_filter_repo_hash = _out.getvalue().strip() + + +# https://lore.kernel.org/tools/[email protected]/ +def xfail_multi_lines(*params): + # 'a40bce548d2c' is the latest and broken version 2.47.0 that practically every test + # environment will get from pyproject.toml. Don't blow up by default for a known issue. + # But let users easily test other git_filter_repo versions + return pytest.param( + *params, + marks=pytest.mark.xfail(git_filter_repo_hash == "a40bce548d2c", + reason="need multi-lines fix from unreleased git_filter_repo v2.48" + ), + ) + @pytest.mark.parametrize('mboxf, bundlef, rep, trargs, compareargs, compareout, b4cfg', [ - ('trailers-thread-with-followups', None, None, [], + xfail_multi_lines('trailers-thread-with-followups', None, None, [], ['log', '--format=%ae%n%s%n%b---', 'HEAD~4..'], 'trailers-thread-with-followups', {'shazam-am-flags': '--signoff'}), - ('trailers-thread-with-cover-followup', None, None, [], + xfail_multi_lines('trailers-thread-with-cover-followup', None, None, [], ['log', '--format=%ae%n%s%n%b---', 'HEAD~4..'], 'trailers-thread-with-cover-followup', {'shazam-am-flags': '--signoff'}), # Test matching trailer updates by subject when patch-id changes
@@ -30,7 +52,7 @@ def prepdir(gitdir: str) -> Generator[str, None, None]: ['log', '--format=%ae%n%s%n%b---', 'HEAD~4..'], 'trailers-thread-with-followups-no-match', {'shazam-am-flags': '--signoff'}), # Test that we properly perserve commits with --- in them - ('trailers-thread-with-followups', 'trailers-with-tripledash', None, [], + xfail_multi_lines('trailers-thread-with-followups', 'trailers-with-tripledash', None, [], ['log', '--format=%ae%n%s%n%b---', 'HEAD~4..'], 'trailers-thread-with-followups-and-tripledash', None), ])
---
base-commit: a6db3f06ce9836a7fc8921f588452804fc62bed1
change-id: 20251101-xfail-057d86fa5f1c
Best regards,
Signature · 1 line
Marc Herbert <[email protected]>