Skip to content

Fix API breakage with pytest 9.1.0#22

Merged
utapyngo merged 2 commits into
utapyngo:masterfrom
mweinelt:pytest-9.1.0-compat
Jun 15, 2026
Merged

Fix API breakage with pytest 9.1.0#22
utapyngo merged 2 commits into
utapyngo:masterfrom
mweinelt:pytest-9.1.0-compat

Conversation

@mweinelt

@mweinelt mweinelt commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The ndiff value matches the previous default.

pytest-dev/pytest@58d8b55

________________________________ test_unordered ________________________________

    def test_unordered():
>       assert [{"a": 1, "b": 2}, 2, 3] == unordered(2, 3, {"b": 2, "a": 3})

test_replace.py:4: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/nix/store/hminjv65d9b6di6l0ivxj92wrbcdhym3-python3.14-pytest-9.1.0/lib/python3.14/site-packages/_pytest/assertion/rewrite.py:498: in _call_reprcompare
    custom = util._reprcompare(ops[i], each_obj[i], each_obj[i + 1])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/hminjv65d9b6di6l0ivxj92wrbcdhym3-python3.14-pytest-9.1.0/lib/python3.14/site-packages/_pytest/assertion/__init__.py:180: in callbinrepr
    hook_result = ihook.pytest_assertrepr_compare(
/nix/store/483a909gxsl0wzbyp9dfrb2ksi42r7i6-python3.14-pluggy-1.6.0/lib/python3.14/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/483a909gxsl0wzbyp9dfrb2ksi42r7i6-python3.14-pluggy-1.6.0/lib/python3.14/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/483a909gxsl0wzbyp9dfrb2ksi42r7i6-python3.14-pluggy-1.6.0/lib/python3.14/site-packages/pluggy/_manager.py:475: in traced_hookexec
    return outcome.get_result()
           ^^^^^^^^^^^^^^^^^^^^
/nix/store/483a909gxsl0wzbyp9dfrb2ksi42r7i6-python3.14-pluggy-1.6.0/lib/python3.14/site-packages/pluggy/_manager.py:472: in <lambda>
    lambda: oldcall(hook_name, hook_impls, caller_kwargs, firstresult)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

config = <_pytest.config.Config object at 0x7ffff54a9a90>, op = '=='
left = [{'a': 1, 'b': 2}, 2, 3], right = [{'b': 2, 'a': 3}, 2, 3]

    def pytest_assertrepr_compare(
        config: Config,
        op: str,
        left: Any,
        right: Any,
    ) -> list[str] | None:
        if (isinstance(left, UnorderedList) or isinstance(right, UnorderedList)) and op == "==":
            verbose = config.getoption("verbose")
            left_repr = saferepr(left)
            right_repr = saferepr(right)
            result = [f"{left_repr} {op} {right_repr}"]
            left_type = left.expected_type if isinstance(left, UnorderedList) else type(left)
            right_type = right.expected_type if isinstance(right, UnorderedList) else type(right)
            if left_type and right_type and left_type != right_type:
                result.append("Type mismatch:")
                result.append(f"{left_type} != {right_type}")
            extra_left, extra_right = _compare_eq_unordered(left, right)
            if len(extra_left) == 1 and len(extra_right) == 1:
                result.append("One item replaced:")
                if pytest.version_tuple < (8, 0, 0):  # pragma: no cover
                    result.extend(
                        _compare_eq_any(extra_left[0], extra_right[0], verbose=verbose),  # type: ignore[call-arg]
                    )
                else:
                    result.extend(
>                       _compare_eq_any(
                            extra_left[0],
                            extra_right[0],
                            highlighter=config.get_terminal_writer()._highlight,  # noqa: SLF001
                            verbose=verbose,
                        ),
                    )
E                   TypeError: _compare_eq_any() missing 1 required positional argument: 'assertion_text_diff_style'

/build/source/pytest_unordered/__init__.py:118: TypeError

@utapyngo

Copy link
Copy Markdown
Owner

Thank you! Could you please also update tox.ini and .github/workflows/test.yml?

@mweinelt

Copy link
Copy Markdown
Contributor Author

Done.

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (5c2d4a8) to head (7fb5750).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #22   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           93        96    +3     
  Branches        26        27    +1     
=========================================
+ Hits            93        96    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mweinelt

Copy link
Copy Markdown
Contributor Author

Ah, now we're breaking compat with earlier pytest versions.

@mweinelt
mweinelt force-pushed the pytest-9.1.0-compat branch from b7b786f to 9d84da3 Compare June 15, 2026 15:23
The ndiff value matches the previous default.
@mweinelt
mweinelt force-pushed the pytest-9.1.0-compat branch from 9d84da3 to ee34a5d Compare June 15, 2026 15:24
Comment thread tox.ini Outdated
@mweinelt
mweinelt force-pushed the pytest-9.1.0-compat branch from ee34a5d to 7fb5750 Compare June 15, 2026 16:48
@utapyngo
utapyngo merged commit 475f6be into utapyngo:master Jun 15, 2026
49 checks passed
@mweinelt
mweinelt deleted the pytest-9.1.0-compat branch June 15, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants