diff --git a/tests/test_release_workflow.py b/tests/test_release_workflow.py index 99fb2909..4ae93519 100644 --- a/tests/test_release_workflow.py +++ b/tests/test_release_workflow.py @@ -577,10 +577,10 @@ def test_the_install_check_runs_on_three_systems_and_python_3_9(workflow): def test_the_header_says_how_to_release(workflow): - """No `docs/release-notes/v1.1.0.md` exists yet, so the header carries - the steps the docs pull request will point at: Brett Heap's acts, with - the trusted publisher's environment REQUIRED and why (RV599, SHOULD 1), - and the limits carried over from openDox-code.""" + """The release notes (`docs/release-notes/v1.1.0.md` and `v1.1.1.md`) + point at this header for the steps, so it carries them: Brett Heap's + acts, with the trusted publisher's environment REQUIRED and why (RV599, + SHOULD 1), and the limits carried over from openDox-code.""" text = WORKFLOW.read_text(encoding="utf-8") assert "# RELEASING TO PyPI." in text assert "gh workflow run release.yml --ref v -f version=" \ diff --git a/tests/test_repo_hygiene.py b/tests/test_repo_hygiene.py index 00fc68b9..844246c2 100644 --- a/tests/test_repo_hygiene.py +++ b/tests/test_repo_hygiene.py @@ -1556,25 +1556,60 @@ def test_the_openrepotools_install_line_is_the_same_everywhere(name): #: THE ONE LINE THAT INSTALLS THIS STANDARD (#564), and every file that #: carries it: the installer it fetches, the command it installs (in its -#: header), the README and its designed reading, and the release notes that -#: introduced it. Pasted by people who cannot check it, like the two lines -#: above, so the copies are held byte for byte. `releases/latest/download/` -#: is what makes it the NEWEST release's `install.sh` every time. +#: header), the README and its designed reading, and the notes of every +#: release since v1.0.1, which introduced it. Pasted by people who cannot +#: check it, like the two lines above, so the copies are held byte for byte. +#: `releases/latest/download/` is what makes it the NEWEST release's +#: `install.sh` every time. ONE_LINE_INSTALL = ( "curl -fsSL https://github.com/opensoft/openRepoShape/releases/latest/" "download/install.sh | bash") -ONE_LINE_INSTALL_IN = ["install.sh", "openRepoShape", "README.md", - "docs/handbook.html", "docs/release-notes/v1.0.1.md"] +#: The notes are read from `docs/release-notes/` when the tests are collected, +#: not named, so a release's notes are held the day they are added, with no +#: edit here (#885: the list named v1.0.1.md alone, so a mistyped line in +#: v1.1.0.md passed). The set is the notes that predate the line: v1.0.0's +#: carries none. A `.md` in that directory that is not a release's notes +#: fails with them until it is named here; a `v*.md` named here fails the +#: second test below. +RELEASE_NOTES = REPO / "docs" / "release-notes" +RELEASE_NOTES_WITHOUT_THE_ONE_LINE_INSTALL = {"v1.0.0.md"} +ONE_LINE_INSTALL_IN = [ + "install.sh", "openRepoShape", "README.md", "docs/handbook.html", + *(path.relative_to(REPO).as_posix() + for path in sorted(RELEASE_NOTES.glob("*.md")) + if path.name not in RELEASE_NOTES_WITHOUT_THE_ONE_LINE_INSTALL)] @pytest.mark.parametrize("name", ONE_LINE_INSTALL_IN) def test_the_one_line_install_is_the_same_everywhere(name): - text = (REPO / name).read_text(encoding="utf-8") + path = REPO / name + text = path.read_text(encoding="utf-8") + other = "" + if path.parent == RELEASE_NOTES: + other = (f", or, if it is not a release's notes, name {path.name!r} " + "in RELEASE_NOTES_WITHOUT_THE_ONE_LINE_INSTALL") assert ONE_LINE_INSTALL in text, ( - f"{name} must carry the one-line install byte for byte:\n" + f"{name} must carry the one-line install byte for byte{other}:\n" f" {ONE_LINE_INSTALL}") +def test_the_one_line_install_holds_the_release_notes_it_found(): + """The notes are found, not named, so a directory that moved or a pattern + that stopped matching would hold none of them and pass; and the set is + for what is not a release's notes, so it may not name one: every `v*.md` + but v1.0.0.md, which predates the line, is held (#885). That one is + spelled out here, not read from the set this test holds to account.""" + notes = {path.relative_to(REPO).as_posix() + for path in RELEASE_NOTES.glob("v*.md") + if path.name != "v1.0.0.md"} + assert {"docs/release-notes/v1.0.1.md", + "docs/release-notes/v1.1.0.md"} <= notes + unheld = sorted(notes - set(ONE_LINE_INSTALL_IN)) + assert not unheld, ( + f"{unheld} are release notes, so they are held, not named in " + "RELEASE_NOTES_WITHOUT_THE_ONE_LINE_INSTALL") + + def test_every_handbook_copy_of_the_one_line_install_is_the_same(): """The handbook shows the one line in three code blocks: the masthead's, step 3's on the Linux, macOS and WSL2 tabs, and step 3's on the Windows