In compilation-mode, how can I make the default py.test output have clickable links to source code (when using py.test's default formatting of tracebacks)?

Does somebody already have appropriate compilation-error-regexp-alist-alist entries?

  • How do you run your tests ? I have all of this when running pytests and I thought it's the default behaviour of compilation-mode.
    – Ehvince
    Commented Mar 20, 2017 at 11:29

1 Answer 1


Running py.test should automatically do it. Go to any directory or python file, run M-x compile RET py.test RET, you will get colorized output and traceback with hyperlinks like this.

enter image description here

It is better to use elpy as it provides better integration with test runners.

  • 1
    A note: elpy's py.test integration is a bit more convenient, for example one can run the current unit test the point is in, switch venvs, etc.
    – Ehvince
    Commented Mar 20, 2017 at 11:27
  • Ah, I didn't know that! Armed with that knowledge, I see that, unknown to me, somehow I'd ended up with cmake and cmake-info customized into the middle of my compilation-error-regexp-alist, which breaks that. Commented Mar 23, 2017 at 22:59
  • I've edited the question to remove the other half, will ask that in a new question Commented Mar 23, 2017 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.