-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow customizing showlocals cutoff #2382
Comments
What is the best way to make possible to configure the unlimited locals output? |
Today |
@nicoddemus Assuming it could easily be set in pytest.ini, that would be a great solution from my perspective. |
I don't think that'd work - presumably |
@The-Compiler yeah when I proposed I wasn't sure it would work, I would say it is worth trying. If that doesn't work we will need a separate variable for that, I suggest |
Cut-off to 200 is problem. Because cutoff implemented in py module. |
I believe this is implemented in Lines 541 to 562 in 966391c
Although here the |
Yes, but at line 554 we call self._saferepr()
This is i talking about |
@ApaDoctor I see thanks. Indeed |
@nicoddemus exactly:)
|
We might consider just copying the |
as we start to copy more and mnore sublibs of pylib into pytest i start to seriously question that approach |
@RonnyPfannschmidt in your opinion should we change |
Relevant code: https://github.com/pytest-dev/py/blob/5f1f794f5c5aa25802ea61b4430648438c8d4b93/py/_io/saferepr.py#L59-L71 - it uses maxsize=240 by default. Apart from that I would say that with |
The
-l
flag - showlocals - for PyTest allows a test to include the state of local variables in case of test failure.However, it seems there is a hard-coded limit of 70 characters in this output. From diving through the code, I believe this happens in the SafeRepr object in
py
.This is an issue in my case because the local variables are dictionaries, and trying to understand a test failure is heavily reliant on the exact content of those variables.
I can log them myself, but doing so defeats the purpose of having
-l
available.Therefore, I would like to request the ability to configure the cutoff for showing locals. Thank you.
The text was updated successfully, but these errors were encountered: