-
-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
Description
requests_cache
is unconditionally imported at uncache_url
, which is called by fetch_with_retries
on retry.
Reproduce
pytest --check-links
on a document containing a broken link that returns retry-after header, for example
<a href="https://zenodo.org/badge/latestdoi/11846/arose/nglview">
Stacktrace:
/.../site-packages/_pytest/runner.py:341: in from_call
result: Optional[TResult] = func()
/.../site-packages/_pytest/runner.py:262: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/.../site-packages/pluggy/_hooks.py:265: in __call__
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
/.../site-packages/pluggy/_manager.py:80: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/.../site-packages/pluggy/_callers.py:60: in _multicall
return outcome.get_result()
/.../site-packages/pluggy/_result.py:60: in get_result
raise ex[1].with_traceback(ex[2])
/.../site-packages/pluggy/_callers.py:39: in _multicall
res = hook_impl.function(*args)
/.../site-packages/_pytest/runner.py:177: in pytest_runtest_call
raise e
/.../site-packages/_pytest/runner.py:169: in pytest_runtest_call
item.runtest()
/.../site-packages/pytest_check_links/plugin.py:375: in runtest
response = self.fetch_with_retries(url)
/.../site-packages/pytest_check_links/plugin.py:344: in fetch_with_retries
self.uncache_url(url_no_anchor)
/.../site-packages/pytest_check_links/plugin.py:353: in uncache_url
from requests_cache import BaseCache
E ModuleNotFoundError: No module named 'requests_cache'
Expected behavior
For the broken link, the test failure message should be
FAILED index.html::/.../index.html <a href=https://zenodo.org/badge/latestdoi/11846/arose/nglview>
instead of
FAILED index.html::/.../index.html <a href=https://zenodo.org/badge/latestdoi/11846/arose/nglview> - ModuleNotFoundError: No module named 'requests_cache'
Moreover, temporarily down links could be retried without requests_cache
.
Context
- Operating System and version:
- Browser and version:
- JupyterLab version:
Troubleshoot Output
Paste the output from running `jupyter troubleshoot` from the command line here. You may want to sanitize the paths in the output.
Command Line Output
Paste the output from your command line running `jupyter lab` here, use `--debug` if possible.
Browser Output
Paste the output from your browser Javascript console here, if applicable.