From 78a258f521a2f298b66463359c106fc4a2c38002 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 28 Apr 2023 06:21:06 -0400 Subject: [PATCH 1/6] build: bump version --- CHANGES.rst | 6 ++++++ coverage/version.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 22ff98dfd..1d3364b51 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,6 +17,12 @@ development at the same time, such as 4.5.x and 5.0. .. Version 9.8.1 — 2027-07-27 .. -------------------------- +Unreleased +---------- + +Nothing yet. + + .. scriv-start-here .. _changes_7-2-4: diff --git a/coverage/version.py b/coverage/version.py index d878ebc1b..f4c5c8157 100644 --- a/coverage/version.py +++ b/coverage/version.py @@ -8,8 +8,8 @@ # version_info: same semantics as sys.version_info. # _dev: the .devN suffix if any. -version_info = (7, 2, 4, "final", 0) -_dev = 0 +version_info = (7, 2, 5, "alpha", 0) +_dev = 1 def _make_version( From f6388c393af842bd432237cf9b5d69adf3de4407 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 28 Apr 2023 07:29:05 -0400 Subject: [PATCH 2/6] build: make a branch and commit for upgrading --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 847e50987..7f529e0c1 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,7 @@ metasmoke: PIP_COMPILE = pip-compile --upgrade --allow-unsafe --resolver=backtracking upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade upgrade: ## Update the *.pip files with the latest packages satisfying *.in files. + git switch -c nedbat/upgrade-$$(date +%Y%m%d) pip install -q -r requirements/pip-tools.pip $(PIP_COMPILE) -o requirements/pip-tools.pip requirements/pip-tools.in $(PIP_COMPILE) -o requirements/pip.pip requirements/pip.in @@ -100,6 +101,7 @@ upgrade: ## Update the *.pip files with the latest packages satisfying *.in $(PIP_COMPILE) -o doc/requirements.pip doc/requirements.in $(PIP_COMPILE) -o requirements/lint.pip doc/requirements.in requirements/dev.in $(PIP_COMPILE) -o requirements/mypy.pip requirements/mypy.in + git commit -am "chore: make upgrade" diff_upgrade: ## Summarize the last `make upgrade` @# The sort flags sort by the package name first, then by the -/+, and From 31c216b67ffb21c589fd39b55fe1bbd26d5bf705 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 28 Apr 2023 07:30:13 -0400 Subject: [PATCH 3/6] chore: make upgrade --- doc/requirements.pip | 2 +- requirements/dev.pip | 18 +++++++++--------- requirements/kit.pip | 2 +- requirements/lint.pip | 18 +++++++++--------- requirements/mypy.pip | 2 +- requirements/pip-tools.pip | 2 +- requirements/pip.pip | 6 +++--- requirements/pytest.pip | 2 +- requirements/tox.pip | 6 +++--- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/requirements.pip b/doc/requirements.pip index 5bd841b0e..16213c7ff 100644 --- a/doc/requirements.pip +++ b/doc/requirements.pip @@ -56,7 +56,7 @@ pygments==2.15.1 # via sphinx pytz==2023.3 # via babel -requests==2.28.2 +requests==2.29.0 # via # scriv # sphinx diff --git a/requirements/dev.pip b/requirements/dev.pip index 60d65c9ac..5fee9ab89 100644 --- a/requirements/dev.pip +++ b/requirements/dev.pip @@ -49,7 +49,7 @@ flaky==3.7.0 # via -r requirements/pytest.in greenlet==2.0.2 # via -r requirements/dev.in -hypothesis==6.72.2 +hypothesis==6.74.1 # via -r requirements/pytest.in idna==3.4 # via requests @@ -98,7 +98,7 @@ parso==0.8.3 # via jedi pkginfo==1.9.6 # via twine -platformdirs==3.2.0 +platformdirs==3.5.0 # via # pylint # tox @@ -114,7 +114,7 @@ pygments==2.15.1 # pudb # readme-renderer # rich -pylint==2.17.2 +pylint==2.17.3 # via -r requirements/dev.in pyproject-api==1.5.1 # via tox @@ -130,7 +130,7 @@ readme-renderer==37.3 # via # -r requirements/dev.in # twine -requests==2.28.2 +requests==2.29.0 # via # -r requirements/dev.in # requests-toolbelt @@ -139,7 +139,7 @@ requests-toolbelt==0.10.1 # via twine rfc3986==2.0.0 # via twine -rich==13.3.4 +rich==13.3.5 # via twine six==1.16.0 # via bleach @@ -154,9 +154,9 @@ tomli==2.0.1 # pyproject-hooks # pytest # tox -tomlkit==0.11.7 +tomlkit==0.11.8 # via pylint -tox==4.5.0 +tox==4.5.1 # via # -r requirements/tox.in # tox-gh @@ -185,7 +185,7 @@ urwid==2.1.2 # urwid-readline urwid-readline==0.13 # via pudb -virtualenv==20.22.0 +virtualenv==20.23.0 # via # -r requirements/pip.in # tox @@ -199,7 +199,7 @@ zipp==3.15.0 # importlib-resources # The following packages are considered to be unsafe in a requirements file: -pip==23.1.1 +pip==23.1.2 # via -r requirements/pip.in setuptools==65.7.0 # via diff --git a/requirements/kit.pip b/requirements/kit.pip index 27360a022..67c070f9c 100644 --- a/requirements/kit.pip +++ b/requirements/kit.pip @@ -28,7 +28,7 @@ packaging==23.1 # via # build # cibuildwheel -platformdirs==3.2.0 +platformdirs==3.5.0 # via cibuildwheel pyelftools==0.29 # via auditwheel diff --git a/requirements/lint.pip b/requirements/lint.pip index 504c34bcc..417900d7c 100644 --- a/requirements/lint.pip +++ b/requirements/lint.pip @@ -67,7 +67,7 @@ flaky==3.7.0 # via -r requirements/pytest.in greenlet==2.0.2 # via -r requirements/dev.in -hypothesis==6.72.2 +hypothesis==6.74.1 # via -r requirements/pytest.in idna==3.4 # via requests @@ -130,7 +130,7 @@ parso==0.8.3 # via jedi pkginfo==1.9.6 # via twine -platformdirs==3.2.0 +platformdirs==3.5.0 # via # pylint # tox @@ -151,7 +151,7 @@ pygments==2.15.1 # readme-renderer # rich # sphinx -pylint==2.17.2 +pylint==2.17.3 # via -r requirements/dev.in pyproject-api==1.5.1 # via tox @@ -169,7 +169,7 @@ readme-renderer==37.3 # via # -r requirements/dev.in # twine -requests==2.28.2 +requests==2.29.0 # via # -r requirements/dev.in # requests-toolbelt @@ -180,7 +180,7 @@ requests-toolbelt==0.10.1 # via twine rfc3986==2.0.0 # via twine -rich==13.3.4 +rich==13.3.5 # via twine scriv==1.3.1 # via -r doc/requirements.in @@ -231,11 +231,11 @@ tomli==2.0.1 # pyproject-hooks # pytest # tox -tomlkit==0.11.7 +tomlkit==0.11.8 # via pylint tornado==6.2 # via livereload -tox==4.5.0 +tox==4.5.1 # via # -r requirements/tox.in # tox-gh @@ -264,7 +264,7 @@ urwid==2.1.2 # urwid-readline urwid-readline==0.13 # via pudb -virtualenv==20.22.0 +virtualenv==20.23.0 # via # -r requirements/pip.in # tox @@ -278,7 +278,7 @@ zipp==3.15.0 # importlib-resources # The following packages are considered to be unsafe in a requirements file: -pip==23.1.1 +pip==23.1.2 # via -r requirements/pip.in setuptools==65.7.0 # via diff --git a/requirements/mypy.pip b/requirements/mypy.pip index 4e1ef4835..b0ff30171 100644 --- a/requirements/mypy.pip +++ b/requirements/mypy.pip @@ -16,7 +16,7 @@ execnet==1.9.0 # via pytest-xdist flaky==3.7.0 # via -r requirements/pytest.in -hypothesis==6.72.2 +hypothesis==6.74.1 # via -r requirements/pytest.in importlib-metadata==6.6.0 # via diff --git a/requirements/pip-tools.pip b/requirements/pip-tools.pip index e26ce5e59..885faed36 100644 --- a/requirements/pip-tools.pip +++ b/requirements/pip-tools.pip @@ -30,7 +30,7 @@ zipp==3.15.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -pip==23.1.1 +pip==23.1.2 # via pip-tools setuptools==65.7.0 # via diff --git a/requirements/pip.pip b/requirements/pip.pip index 8ba199868..579d5028f 100644 --- a/requirements/pip.pip +++ b/requirements/pip.pip @@ -10,19 +10,19 @@ filelock==3.12.0 # via virtualenv importlib-metadata==6.6.0 # via virtualenv -platformdirs==3.2.0 +platformdirs==3.5.0 # via virtualenv typing-extensions==4.5.0 # via # importlib-metadata # platformdirs -virtualenv==20.22.0 +virtualenv==20.23.0 # via -r requirements/pip.in zipp==3.15.0 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: -pip==23.1.1 +pip==23.1.2 # via -r requirements/pip.in setuptools==65.7.0 # via -r requirements/pip.in diff --git a/requirements/pytest.pip b/requirements/pytest.pip index d825d8e68..ba1e9baaf 100644 --- a/requirements/pytest.pip +++ b/requirements/pytest.pip @@ -16,7 +16,7 @@ execnet==1.9.0 # via pytest-xdist flaky==3.7.0 # via -r requirements/pytest.in -hypothesis==6.72.2 +hypothesis==6.74.1 # via -r requirements/pytest.in importlib-metadata==6.6.0 # via diff --git a/requirements/tox.pip b/requirements/tox.pip index 5d4389680..d88ccc958 100644 --- a/requirements/tox.pip +++ b/requirements/tox.pip @@ -27,7 +27,7 @@ packaging==23.1 # via # pyproject-api # tox -platformdirs==3.2.0 +platformdirs==3.5.0 # via # tox # virtualenv @@ -39,7 +39,7 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.5.0 +tox==4.5.1 # via # -r requirements/tox.in # tox-gh @@ -50,7 +50,7 @@ typing-extensions==4.5.0 # importlib-metadata # platformdirs # tox -virtualenv==20.22.0 +virtualenv==20.23.0 # via tox zipp==3.15.0 # via importlib-metadata From 731e9a776539dde46ca4c626ed67a5a09e0fe76a Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 30 Apr 2023 06:28:24 -0400 Subject: [PATCH 4/6] fix: a fake stdout might not have isatty --- CHANGES.rst | 4 +++- coverage/misc.py | 2 +- tests/test_misc.py | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1d3364b51..987442e2d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,7 +20,9 @@ development at the same time, such as 4.5.x and 5.0. Unreleased ---------- -Nothing yet. +- Fix: ``html_report()`` could fail with an AttributeError on ``isatty`` if run + in an unusual environment where sys.stdout had been replaced. This is now + fixed. .. scriv-start-here diff --git a/coverage/misc.py b/coverage/misc.py index 061682ee5..908b0dd24 100644 --- a/coverage/misc.py +++ b/coverage/misc.py @@ -394,7 +394,7 @@ def stdout_link(text: str, url: str) -> str: If attached to a terminal, use escape sequences. Otherwise, just return the text. """ - if sys.stdout.isatty(): + if hasattr(sys.stdout, "isatty") and sys.stdout.isatty(): return f"\033]8;;{url}\a{text}\033]8;;\a" else: return text diff --git a/tests/test_misc.py b/tests/test_misc.py index 455a3bc1d..d489f171e 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -6,6 +6,7 @@ from __future__ import annotations import sys +from typing import Any from unittest import mock import pytest @@ -165,3 +166,19 @@ def test_stdout_link_tty() -> None: def test_stdout_link_not_tty() -> None: # Without mocking isatty, it reports False in a pytest suite. assert stdout_link("some text", "some url") == "some text" + + +def test_stdout_link_with_fake_stdout() -> None: + # If stdout is another object, we should still be ok. + class FakeStdout: + """New stdout, has .write(), but not .isatty().""" + def __init__(self, f: Any) -> None: + self.f = f + + def write(self, data: str) -> Any: + """Write through to the underlying file.""" + return self.f.write(data) + + with mock.patch.object(sys, "stdout", FakeStdout(sys.stdout)): + link = stdout_link("some text", "some url") + assert link == "some text" From 51f14fe968b31be7804d80e23495cb8d793d60be Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 30 Apr 2023 06:39:29 -0400 Subject: [PATCH 5/6] docs: prep for 7.2.5 --- CHANGES.rst | 10 ++++++---- coverage/version.py | 4 ++-- doc/conf.py | 6 +++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 987442e2d..b4da5e1b6 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -17,16 +17,18 @@ development at the same time, such as 4.5.x and 5.0. .. Version 9.8.1 — 2027-07-27 .. -------------------------- -Unreleased ----------- +.. scriv-start-here + +.. _changes_7-2-5: + +Version 7.2.5 — 2023-04-30 +-------------------------- - Fix: ``html_report()`` could fail with an AttributeError on ``isatty`` if run in an unusual environment where sys.stdout had been replaced. This is now fixed. -.. scriv-start-here - .. _changes_7-2-4: Version 7.2.4 — 2023-04-28 diff --git a/coverage/version.py b/coverage/version.py index f4c5c8157..516d00c15 100644 --- a/coverage/version.py +++ b/coverage/version.py @@ -8,8 +8,8 @@ # version_info: same semantics as sys.version_info. # _dev: the .devN suffix if any. -version_info = (7, 2, 5, "alpha", 0) -_dev = 1 +version_info = (7, 2, 5, "final", 0) +_dev = 0 def _make_version( diff --git a/doc/conf.py b/doc/conf.py index f0b2d6e42..fbd7e3f3a 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -66,11 +66,11 @@ # @@@ editable copyright = "2009–2023, Ned Batchelder" # pylint: disable=redefined-builtin # The short X.Y.Z version. -version = "7.2.4" +version = "7.2.5" # The full version, including alpha/beta/rc tags. -release = "7.2.4" +release = "7.2.5" # The date of release, in "monthname day, year" format. -release_date = "April 28, 2023" +release_date = "April 30, 2023" # @@@ end rst_epilog = """ From 9d4ac4851f8f741a304ac2eb54573eac0c588180 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 30 Apr 2023 06:39:56 -0400 Subject: [PATCH 6/6] docs: sample HTML for 7.2.5 --- doc/sample_html/d_7b071bdc2a35fa80___init___py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80___main___py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80_cogapp_py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80_makefiles_py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80_test_cogapp_py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80_test_makefiles_py.html | 8 ++++---- .../d_7b071bdc2a35fa80_test_whiteutils_py.html | 8 ++++---- doc/sample_html/d_7b071bdc2a35fa80_whiteutils_py.html | 8 ++++---- doc/sample_html/index.html | 8 ++++---- doc/sample_html/status.json | 2 +- 10 files changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html index 6351b32dd..cf43ec9ee 100644 --- a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html +++ b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html @@ -66,8 +66,8 @@

^ index     » next       - coverage.py v7.2.4, - created at 2023-04-28 05:33 -0400 + coverage.py v7.2.5, + created at 2023-04-30 06:39 -0400