Skip to content
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

"-l" does not dump variables where "--tb" is not "long" #494

Closed
pytestbot opened this issue Mar 31, 2014 · 15 comments
Closed

"-l" does not dump variables where "--tb" is not "long" #494

pytestbot opened this issue Mar 31, 2014 · 15 comments
Labels
topic: tracebacks related to displaying and handling of tracebacks type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc)


Example output

    > assert hist == ['before', 'the-return-valuex', 'after', 'finally', 'closed']
    E assert ['before', 't...ly', 'closed'] == ['before', 'th...ly', 'closed']
    E At index 1 diff: 'the-return-value' != 'the-return-valuex'

I use these options:

 -rxEfsl
--strict
--ignore docs/conf.py
--ignore setup.py
--doctest-modules
--doctest-glob \*.rst
--tb short

@pytestbot
Copy link
Contributor Author

Original comment by Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc):


I would expect to have the value of hist shown.

@pytestbot
Copy link
Contributor Author

Original comment by Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc):


I have also tried -l but it does not help - there's no traceback, it's just a failed assertion.

@pytestbot
Copy link
Contributor Author

Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):


This should probably behave similarly to how diffs and dicts work: it should show a hint that you can get the full diff using -v and then that should also be implemented.

@pytestbot
Copy link
Contributor Author

Original comment by Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc):


Seems --tb short makes the difference.

I would stop using it but the default tracebacks are ridiculously huge, I can't even see where they start ...

@pytestbot
Copy link
Contributor Author

Original comment by Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc):


@flub I think this is a bug, only --tb long works with -l.

@pytestbot
Copy link
Contributor Author

Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):


Err, I'm not so sure about your classification as bug and title re-naming. This issue was about seeing the full lists when comparing two lists. Now you've confused it with something which is potentially an other issue: -l/--tb=short interaction. If the latter is an issue it should be discussed in a separate report rather then hijack this one.

@pytestbot
Copy link
Contributor Author

Original comment by Ionel Cristian Mărieș (BitBucket: ionelmc, GitHub: ionelmc):


I'm sorry, I thought I created this issue ...

@pytestbot
Copy link
Contributor Author

Original comment by Floris Bruynooghe (BitBucket: flub, GitHub: flub):


Sorry, hijacking is probably a big word. It just seemed to me like the original report was a totally different report, so now I just don't know if you still care about the assert repr of lists or not.

On whether -l/--tb=short should work together or not I'm not in a position to say and would wait for someone else's opinion.

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
@pfctdayelise pfctdayelise added the topic: tracebacks related to displaying and handling of tracebacks label Jul 25, 2015
@asottile
Copy link
Member

thoughts on making --showlocals + --tb= anything but long / auto an error? I could write up a PR for this to features

CC @nicoddemus @blueyed

@blueyed
Copy link
Contributor

blueyed commented Apr 21, 2019

It could be useful with other styles, e.g. short: #1715.

blueyed added a commit to blueyed/pytest-cov that referenced this issue Nov 19, 2019
It silently ignores `-l` etc, and should be used on-demand only.

Ref: pytest-dev/pytest#494
blueyed added a commit to pytest-dev/pytest-cov that referenced this issue Nov 22, 2019
It silently ignores `-l` etc, and should be used on-demand only.

Ref: pytest-dev/pytest#494
@rgommers
Copy link

thoughts on making --showlocals + --tb= anything but long / auto an error? I could write up a PR for this to features

It could be useful with other styles, e.g. short: #1715.

+1 for making showlocals work with short. There's no reason to disable showlocals for --tb=short, it looks like a clear bug. The code comment here also indicates this wasn't intended, showlocals should only be disable for --tb=native.

Found this issue because we ran into the same problem for SciPy at scipy/scipy#11282

@rgommers
Copy link

@blueyed @nicoddemus is this bug not getting attention because it's low-prio, or because of the confusing description/history in the comments here? If the latter, I can open a new bug if it helps.

@asottile
Copy link
Member

@rgommers no reason -- there's 480+ issues in the backlog currently -- would you like to take a stab at a PR to enable this?

pv added a commit to pv/pytest that referenced this issue Dec 30, 2019
Enable showing local variables when asked to do so in the short
traceback mode.

Fix pytest-dev#494
pv added a commit to pv/pytest that referenced this issue Dec 30, 2019
Enable showing local variables when asked to do so in the short
traceback mode.

Fix pytest-dev#494
pv added a commit to pv/pytest that referenced this issue Dec 30, 2019
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes pytest-dev#494
@pv
Copy link
Contributor

pv commented Dec 30, 2019

Allowing --showlocals with --tb=short seems simple: #6384

pv added a commit to pv/pytest that referenced this issue Dec 30, 2019
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes pytest-dev#494
pv added a commit to pv/pytest that referenced this issue Dec 30, 2019
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes pytest-dev#494
@rgommers
Copy link

rgommers commented Jan 1, 2020

thanks @pv!

pv added a commit to pv/pytest that referenced this issue Jan 13, 2020
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes pytest-dev#494
pv added a commit to pv/pytest that referenced this issue Jan 13, 2020
Enable showing local variables when asked to do so in the short
traceback mode.

Fixes pytest-dev#494
blueyed added a commit that referenced this issue Jan 16, 2020
Make --showlocals work together with --tb=short

Fixes #494
Ref: #1715
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: tracebacks related to displaying and handling of tracebacks type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

6 participants