Skip to content

Commit d683163

Browse files
committed
Add tests
1 parent 2a58a59 commit d683163

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

tests/test_run_release.py

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def test_check_doc_unreleased_version_no_file_alpha(tmp_path: Path) -> None:
8888
run_release.check_doc_unreleased_version(cast(ReleaseShelf, db))
8989

9090

91-
def test_check_doc_unreleased_version_ok(monkeypatch, tmp_path: Path) -> None:
91+
def test_check_doc_unreleased_version_ok(tmp_path: Path) -> None:
9292
prepare_fake_docs(
9393
tmp_path,
9494
"<div>New in 3.13</div>",
@@ -124,3 +124,55 @@ def test_check_doc_unreleased_version_waived(monkeypatch, tmp_path: Path) -> Non
124124
}
125125
with fake_answers(monkeypatch, ["yes"]):
126126
run_release.check_doc_unreleased_version(cast(ReleaseShelf, db))
127+
128+
129+
def test_modify_the_docs_by_version_page_prerelease(
130+
capsys: pytest.LogCaptureFixture,
131+
) -> None:
132+
# Arrange
133+
db = {"release": Tag("3.14.0a7")}
134+
135+
# Act
136+
run_release.modify_the_docs_by_version_page(cast(ReleaseShelf, db))
137+
138+
# Assert
139+
captured = capsys.readouterr()
140+
assert captured.out == ""
141+
assert captured.err == ""
142+
143+
144+
def test_modify_the_docs_by_version_page_final_no(capsys, monkeypatch) -> None:
145+
# Arrange
146+
db = {"release": Tag("3.13.3")}
147+
148+
# Act
149+
with (
150+
fake_answers(monkeypatch, ["no"]),
151+
pytest.raises(run_release.ReleaseException),
152+
):
153+
run_release.modify_the_docs_by_version_page(cast(ReleaseShelf, db))
154+
155+
# Assert
156+
captured = capsys.readouterr()
157+
assert (
158+
"* `Python 3.13.3 <https://docs.python.org/release/3.13.3/>`_, documentation released on"
159+
in captured.out
160+
)
161+
assert captured.err == ""
162+
163+
164+
def test_modify_the_docs_by_version_page_final_yes(capsys, monkeypatch) -> None:
165+
# Arrange
166+
db = {"release": Tag("3.13.3")}
167+
168+
# Act
169+
with fake_answers(monkeypatch, ["yes"]):
170+
run_release.modify_the_docs_by_version_page(cast(ReleaseShelf, db))
171+
172+
# Assert
173+
captured = capsys.readouterr()
174+
assert (
175+
"* `Python 3.13.3 <https://docs.python.org/release/3.13.3/>`_, documentation released on"
176+
in captured.out
177+
)
178+
assert captured.err == ""

0 commit comments

Comments
 (0)