Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Linking to PyCharm #223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions ward/_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,11 @@ def output_test_result_line(
grid.add_column()
columns = [
Padding(outcome_tag, style=test_style, pad=(0, 1, 0, 1)),
Padding(f"{test_location}{test_case_number}", style="muted", pad=(0, 1, 0, 1)),
Padding(
f"[link=pycharm://open?file={test.path.absolute()}&line={test.line_number}]{test_location}{test_case_number}[/link]",
style="muted",
pad=(0, 1, 0, 1),
),
Padding(
Markdown(test.description, inline_code_theme="ansi_dark"), pad=(0, 1, 0, 0)
),
Expand Down Expand Up @@ -360,7 +364,14 @@ def output_dots_module(

def print_dot(result: TestResult) -> None:
style = outcome_to_style(result.outcome)
console.print(result.outcome.display_char, style=style, end="")
if result.outcome == TestOutcome.FAIL:
console.print(
f"[link=pycharm://open?file={result.test.path}&line={result.test.line_number}]{result.outcome.display_char}",
style=style,
end="",
)
else:
console.print(result.outcome.display_char, style=style, end="")


def print_end_of_line_for_dots(
Expand Down