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

Add line of crash to new summary #125

Open
blueyed opened this issue Jul 5, 2017 · 10 comments
Open

Add line of crash to new summary #125

blueyed opened this issue Jul 5, 2017 · 10 comments

Comments

@blueyed
Copy link
Collaborator

blueyed commented Jul 5, 2017

The new summary uses the line of the test function itself, but the line containing the crash would be more useful often (to jump directly to it).

I think this could still get parsed from crashrepr, no?

I think both line numbers could be displayed in the summary similar to https://github.com/fschulze/pytest-pdb/pull/3/files#diff-30e02d59448c958f16700f2683820a2cR28.

@azmeuk
Copy link

azmeuk commented Jul 18, 2017

What is crashrepr? Google has almost nothing about this.

@Teemu
Copy link
Owner

Teemu commented Aug 14, 2017

I have personally noticed that location of the actual crash is often meaningless (e.g. inside some third party library when invalid argument is passed)

@blueyed
Copy link
Collaborator Author

blueyed commented Aug 14, 2017

IIRC it should be from the actual test always?!
Otherwise it would be possible to get to it somehow probably.
See fschulze/pytest-pdb#3.

@blueyed
Copy link
Collaborator Author

blueyed commented Aug 29, 2018

@Frozenball
Assuming that the crash line is from the test, do you agree that it would be more useful?
The use case is quickly going to the failed assertion etc in the test, which is currently not possible, even if you have setup your editor to handle test IDs (test_foo.py::test_func), because pytest-sugar also does not use those in the summary.
I'd be happy to look into this, but would like to know first if it would be considered.

@blueyed
Copy link
Collaborator Author

blueyed commented Aug 29, 2018

To be clear, currently it looks like this:

 tests/test_foo.py ✓✓✓✓✓✓✓✓

――――― test_foo_bar ――――――
tests/test_foo.py:985: in test_foo_bar
    assert m.call_count == 1
E   assert 2 == 1
E    +  …
------ Captured stderr setup ------
…

 tests/test_foo.py ⨯✓✓✓s✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓

――――――― test_foo_baz ―――――
tests/test_foo.py:1064: in test_foo_baz
    …
E   Exception: something_bad

 tests/test_foo.py ⨯✓✓✓✓                                                                                                                            100% ██████████
======== short test summary info =======
FAIL tests/test_foo.py::test_foo_bar
FAIL tests/test_foo.py::test_foo_baz

Results (7.96s):
      32 passed
       2 failed
         - tests/test_foo.py:969 test_foo_bar
         - tests/test_foo.py:998 test_foo_baz
       1 skipped

Since I am using -ra I get the test IDs in the short test summary info, which allows to quickly go to the test itself already (although it requires magic in your editor).

I think -ra would not be necessary at all, and pytest-sugar could display the results as:

Results (7.96s):
      32 passed
       2 failed
         - tests/test_foo.py:985 test_foo::test_foo_bar
         - tests/test_foo.py:1064 test_foo::test_foo_baz
       1 skipped

I.e. it would use the actual line, and also display the full test ID.

@Teemu
Copy link
Owner

Teemu commented Aug 29, 2018 via email

@Teemu
Copy link
Owner

Teemu commented Aug 29, 2018 via email

@blueyed
Copy link
Collaborator Author

blueyed commented Aug 29, 2018

Yes, that's what I would like to achieve/see also.

@blueyed
Copy link
Collaborator Author

blueyed commented Aug 29, 2018

btw: I can highly recommend https://github.com/fschulze/pytest-pdb, which adds a gt command that allows to go the test from within pdb and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants