Skip to content

Commit

Permalink
misc URL updates
Browse files Browse the repository at this point in the history
And test status codes.
  • Loading branch information
Carreau committed Oct 1, 2024
1 parent 116057e commit 5ad9b97
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion intersphinx_registry/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ipywidgets": ["https://ipywidgets.readthedocs.io/en/latest/", null],
"jax": ["https://jax.readthedocs.io/en/latest/", null],
"jedi": ["https://jedi.readthedocs.io/en/latest/", null],
"jinja": ["http://jinja.pocoo.org/docs/", null],
"jinja": ["https://jinja.palletsprojects.com/", null],
"joblib": ["https://joblib.readthedocs.io/en/latest/", null],
"jupyter": ["https://docs.jupyter.org/en/latest/", null],
"jupyter-server": ["https://jupyter-server.readthedocs.io/en/stable/", null],
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ minversion = "7.0"
# -n auto:
# run @parametrize tests in parallel as some use requests.
# requires ptest x-dist
addopts = ["-n","auto", "--strict-config", "--strict-markers", "-ra"]
addopts = ["-n","auto", "--strict-config", "--strict-markers", "-ra",'--durations=10']
filterwarnings = ["error"]
log_cli_level = "INFO"
testpaths = ["tests"]
Expand Down
13 changes: 11 additions & 2 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
MAPPING = _get_all_mappings()
keys = set(MAPPING.keys())

TIMEOUT = 5 # sec

# click does return a 301 instead of a 30
CLICK_WRONG_301 = 301

@pytest.mark.parametrize("key", list(sorted(keys - {"jinja"})))
def test_format(key: str):
Expand All @@ -21,15 +25,20 @@ def test_format(key: str):
assert obj.endswith("/"), obj
assert "readthedocs.org" not in obj
assert obj.startswith(url)
requests.head(obj, allow_redirects=True).raise_for_status()
res = requests.head(obj, allow_redirects=True, timeout=TIMEOUT)
res.raise_for_status()
assert res.status_code in (200, 302, CLICK_WRONG_301)


@pytest.mark.parametrize("key", list(sorted(keys)))
def test_reach_objects_inv(key: str):
for v in MAPPING[key]:
if v is None:
continue
requests.head(v + "objects.inv").raise_for_status()
res = requests.head(v + "objects.inv", timeout=TIMEOUT)
res.raise_for_status()
assert res.status_code in (200, 302, CLICK_WRONG_301)



def test_bad():
Expand Down

0 comments on commit 5ad9b97

Please sign in to comment.