Open schnemensch opened 2 years ago
The stacktrace you pasted says unittest.mock
was called when linkcheck builder goes importing the requests library. I guess the requests library has been mocked on your project, right?
File "/localdev/user/py_venvs/py3_tif/lib/python3.9/site-packages/sphinx/builders/linkcheck.py", line 28, in <module>
from requests import Response
File "/u/ccmaster/SDR/main/linux64/python3/gcc-9.2/lib/python3.9/unittest/mock.py", line 1093, in __call__
return self._mock_call(*args, **kwargs)
File "/u/ccmaster/SDR/main/linux64/python3/gcc-9.2/lib/python3.9/unittest/mock.py", line 1097, in _mock_call
return self._execute_mock_call(*args, **kwargs)
File "/u/ccmaster/SDR/main/linux64/python3/gcc-9.2/lib/python3.9/unittest/mock.py", line 1158, in _execute_mock_call
result = effect(*args, **kwargs)
That is a good point.
I am using unittest.mock
to mock some private modules which I do not have access to while generating the documentation.
The requests packages should not be part of this mocking and I do not use the requests package at all in my code.
I just have it installed because it is a sphinx requirement.
Could you share your project or a minimal reproducible example? I can't reproduce the error on my local. At least, I need to know what objects are mocked.
Describe the bug
If I have requests 2.27.1 (or 2.27.0) installed, I am unable to build my documentation. During the build I get the following exception:
As explained here they have added the JSONDecodeError in with the 2.27.0 release.
I have no issues with older versions of the requests package and I will go back to an older version, but maybe your package requirements should be updated as currently a fresh install is failing for me.
I am not using the command line of sphinx, but I am using:
sphinx.cmd.build.main(['-q', '-W', '--keep-going', '.', str(docs_dir)])
Full Traceback:
How to Reproduce
Expected behavior
No response
Your project
Not able to share as it is classified
Screenshots
No response
OS
CentOS7
Python version
3.9.1
Sphinx version
4.4.0
Sphinx extensions
No response
Extra tools
No response
Additional context
No response