You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are switching our project to Python 3.12. We use pytest and httpretty in order to mock some requests. From Python 3.12 datetime.utcnow is deprecated: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow
When running tests using pytest, warnings raise an exception and since datetime.utcnow is used by httpretty in a thread: https://github.com/gabrielfalcao/HTTPretty/blob/main/httpretty/core.py#L1077 the warning is not visible anywhere. httpretty does not fill the file with HTTP content and tests fail with something like this: ConnectionError: Error requesting 'http://localhost:9000/path': ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')). It fails because http client gets an empty string from the file when trying to read the first line of HTTP response: https://github.com/python/cpython/blob/3.12/Lib/http/client.py#L285
It can be workarounded by adding an ignore to pytest.ini file.
The text was updated successfully, but these errors were encountered:
We are switching our project to Python 3.12. We use
pytest
andhttpretty
in order to mock some requests. From Python 3.12datetime.utcnow
is deprecated: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnowWhen running tests using
pytest
, warnings raise an exception and sincedatetime.utcnow
is used by httpretty in a thread: https://github.com/gabrielfalcao/HTTPretty/blob/main/httpretty/core.py#L1077 the warning is not visible anywhere.httpretty
does not fill the file with HTTP content and tests fail with something like this:ConnectionError: Error requesting 'http://localhost:9000/path': ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
. It fails because http client gets an empty string from the file when trying to read the first line of HTTP response: https://github.com/python/cpython/blob/3.12/Lib/http/client.py#L285It can be workarounded by adding an ignore to
pytest.ini
file.The text was updated successfully, but these errors were encountered: