Skip to content

Commit

Permalink
test: a test that github_release calls check_markdown_links properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ned Batchelder committed Oct 19, 2023
1 parent bdcb076 commit 0deef76
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/scriv/linkcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def check_one_link(url: str) -> None:
"""Check if a URL is reachable. Logs a warning if not."""
try:
resp = requests.head(url, timeout=60, allow_redirects=True)
except Exception as exc: # pylint: disable=broad-exception-caught
except Exception as exc: # pylint: disable=broad-exception-caught
logger.warning(f"Failed check for {url!r}: {exc}")
return

Expand Down
11 changes: 11 additions & 0 deletions tests/test_ghrel.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,17 @@ def test_bad_explicit_repo(cli_invoke, repo):
assert str(result.exception) == f"Repo must be owner/reponame: {repo!r}"


def test_check_links(cli_invoke, scenario1, mocker):
mock_check_links = mocker.patch("scriv.ghrel.check_markdown_links")
cli_invoke(["github-release", "--all", "--dry-run", "--check-links"])
assert mock_check_links.mock_calls == [
call("A good release\n"),
call("Nothing to say.\n"),
call("A beginning\n"),
call("Very first.\n"),
]


@pytest.fixture()
def no_actions(mock_create_release, mock_update_release, responses):
"""Check that nothing really happened."""
Expand Down

0 comments on commit 0deef76

Please sign in to comment.