Skip to content

compat: add pformat helper using expand=True on Python 3.15+ - #14883

Closed
satyamadhav9104 wants to merge 2 commits into
pytest-dev:mainfrom
satyamadhav9104:feat/compat-pformat-expand-14859
Closed

compat: add pformat helper using expand=True on Python 3.15+#14883
satyamadhav9104 wants to merge 2 commits into
pytest-dev:mainfrom
satyamadhav9104:feat/compat-pformat-expand-14859

Conversation

@satyamadhav9104

Copy link
Copy Markdown

Fixes #14859

Summary

Adds a \pformat\ compatibility helper in \src/_pytest/compat.py\ that uses \�xpand=True\ when running on Python 3.15+ (where supported by standard library \pprint.pformat), falling back to standard \pprint.pformat\ on earlier Python versions.

Changes

  • \src/_pytest/compat.py: Added \pformat = functools.partial(pprint.pformat, expand=True)\ for Python 3.15+.
  • \ esting/test_compat.py: Added \ est_pformat\ unit test verifying _pytest.compat.pformat\ formatting.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

clanker blocked

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.

use expand=True for pformat(...) in python 3.15+

2 participants