emacs-python-pytest icon indicating copy to clipboard operation
emacs-python-pytest copied to clipboard

Make test failures clickable with

Open petr-tik opened this issue 3 years ago • 2 comments

thanks for working on this package - I enjoy using it. One thing I noticed is the lack of support to go from $FILE_NAME:$LINE_NUMBER for every error to opening it in the other window. Example output below

test_my_appy.py .FF                                                      [100%]

=================================== FAILURES ===================================
________________________________ test_will_fail ________________________________

    def test_will_fail():
>       assert False
E       assert False

test_my_appy.py:9: AssertionError
_____________________________ test_will_fail_hard ______________________________

    def test_will_fail_hard():
    
        x = 12 + 7
        print("Hello")
    
>       assert x == 20
E       assert 19 == 20

test_my_appy.py:17: AssertionError

rustic-mode implements that by defining own regexes to match warnings and errors in the compilation-mode output. https://github.com/brotzeit/rustic/blob/master/rustic-compile.el#L116-L181

Doing that would also allow disabling the colour (sic!) pytest cmdline arg with emacs font-locks instead of ANSI, which might break over tramp. [Aside I sometimes experience projectile-related problems with pytest over tramp]

Was wondering if you would be open to me contributing a definition of the compilation mode?

I was thinking about the following as a first pass: python-pytest-error to match test_my_appy.py:9 and test_my_appy.py:17 and allow users to hit Enter and open the buffer with that file on line 9 or 17 respectively.

petr-tik avatar Jan 09 '21 01:01 petr-tik

sorry for getting back late to this. yeah, of course this would be useful addition!

wbolster avatar Feb 04 '21 20:02 wbolster

turns out it works locally, but not over tramp. Not sure if it's a limitation in tramp or not

petr-tik avatar Feb 04 '21 22:02 petr-tik