From 40cc55c0dc18d999cd4d3c1b278d6e120f858ab5 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 26 Apr 2023 18:36:02 -0400 Subject: fix: no need for terminal url except for html report --- CHANGES.rst | 7 +++++++ CONTRIBUTORS.txt | 1 + coverage/report.py | 8 +------- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index ec31b21b..5f89576f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,11 +20,18 @@ development at the same time, such as 4.5.x and 5.0. Unreleased ---------- +- When the HTML report location is printed to the terminal, it's now a + terminal-compatible URL, so that you can click the location to open the HTML + file in your browser. Finishes `issue 1523`_ thanks to `Ricardo Newbery + `_. + - Docs: a new :ref:`Migrating page ` with details about how to migrate between major versions of coverage.py. It currently covers the wildcard changes in 7.x. Thanks, `Brian Grohe `_. +.. _issue 1523: https://github.com/nedbat/coveragepy/issues/1523 .. _pull 1610: https://github.com/nedbat/coveragepy/pull/1610 +.. _pull 1613: https://github.com/nedbat/coveragepy/pull/1613 .. scriv-start-here diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index f5f2898f..b02f7add 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -147,6 +147,7 @@ Peter Ebden Peter Portante Phebe Polk Reya B +Ricardo Newbery Rodrigue Cloutier Roger Hu Ross Lawley diff --git a/coverage/report.py b/coverage/report.py index 1e14eb78..09eed0a8 100644 --- a/coverage/report.py +++ b/coverage/report.py @@ -5,7 +5,6 @@ from __future__ import annotations -import os import sys from typing import Callable, Iterable, Iterator, IO, Optional, Tuple, TYPE_CHECKING @@ -59,12 +58,7 @@ def render_report( try: ret = reporter.report(morfs, outfile=outfile) if file_to_close is not None: - if sys.stdout.isatty(): - file_path = f"file://{os.path.abspath(output_path)}" - print_path = f"\033]8;;{file_path}\a{output_path}\033]8;;\a" - else: - print_path = output_path - msgfn(f"Wrote {reporter.report_type} to {print_path}") + msgfn(f"Wrote {reporter.report_type} to {output_path}") delete_file = False return ret finally: -- cgit v1.2.1