This commit is contained in:
Sorin Sbarnea 2024-06-20 13:37:42 +02:00 committed by GitHub
commit 083ee98b3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Allow users to override repr maxsize value (240) by defining
:envvar:`PYTEST_DEFAULT_REPR_MAX_SIZE` environment variable.

View File

@ -1145,6 +1145,11 @@ processes can inspect it, see :ref:`pytest current test env` for more informatio
When set, pytest will print tracing and debug information.
.. envvar:: PYTEST_DEFAULT_REPR_MAX_SIZE
Setting this would override the implicit 240 chars limit used for truncating
longer error messages.
.. envvar:: PYTEST_DISABLE_PLUGIN_AUTOLOAD
When set, disables plugin auto-loading through :std:doc:`entry point packaging

View File

@ -1,3 +1,4 @@
import os
import pprint
import reprlib
from typing import Optional
@ -93,7 +94,7 @@ def safeformat(obj: object) -> str:
# Maximum size of overall repr of objects to display during assertion errors.
DEFAULT_REPR_MAX_SIZE = 240
DEFAULT_REPR_MAX_SIZE = int(os.environ.get("PYTEST_DEFAULT_REPR_MAX_SIZE", 240))
def saferepr(