pytest-dev / pytest-dev/pytest

Support OSC 8 hyperlinks

Open
#13,580 5 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic: reporting type: enhancement
Dominant language
Python
Stars
14.5k
Forks
3.4k
Avg merge
2d 9h
Merged PRs (30d)
35

Description

What's the problem this feature will solve?

Being able to quickly open any file mentioned when a test fails or crashes.

Describe the solution you'd like

Terminal emulators now have hyperlinks! 🎉🎉🎉

It's supported by most terminal emulators, as well as application like ls and less:
https://github.com/Alhadis/OSC8-Adoption/

pytest should have a new --hyperlinks command line option, similar to the one that ls now has.

All paths in pytest's output should be links when this option is turned on (which it should be by default, IMO. Terminal emulators that don't support hyperlinks fail gracefully (the escape sequences and the target URL are simply ignored)).

Then you can configure your terminal emulator / tmux to open the link in your favorite text editor / IDE.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating pytest's command-line option handling and the code that formats paths in test output. Check the existing output-related tests, then verify that --hyperlinks makes all reported paths terminal hyperlinks while preserving normal output when the option is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.