wbolster / emacs-python-pytest

run pytest inside emacs
BSD 3-Clause "New" or "Revised" License
149 stars 26 forks source link

Make test failures clickable with #39

Open petr-tik opened 3 years ago

petr-tik commented 3 years ago

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.

wbolster commented 3 years ago

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

petr-tik commented 3 years ago

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