Skip to content

Commit 432ec0a

Browse files
committed
Handle cases where "project_urls" is None.
1 parent d37868e commit 432ec0a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

seed_intersphinx_mapping/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get_sphinx_doc_url(pypi_name: str) -> str:
9090

9191
pypi_data = (pypi_api / pypi_name / "json").get()
9292

93-
if "project_urls" in pypi_data["info"]:
93+
if "project_urls" in pypi_data["info"] and pypi_data["info"]["project_urls"]:
9494
docs_dict = search_dict(pypi_data["info"]["project_urls"], r"^[dD]oc(s|umentation)")
9595
if docs_dict:
9696

tests/test_core.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ def test_get_sphinx_doc_url():
9797
assert cache.clear(get_sphinx_doc_url)
9898
assert not (cache.cache_dir / "get_sphinx_doc_url.json").is_file()
9999

100+
with pytest.raises(ValueError, match="Documentation URl not found in data from PyPI."):
101+
get_sphinx_doc_url("sphinx-prompt")
102+
100103

101104
def test_get_sphinx_doc_url_wrapping():
102105
assert get_sphinx_doc_url.__name__ == "get_sphinx_doc_url"

0 commit comments

Comments
 (0)