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:
Potentially it might be addressing
- gabrielfalcao#474
In our case we got datalad tests failing since we trigger errors on all new
deprecation warnigns and this was the one this time
.pybuild/cpython3_3.12_datalad/build/datalad/downloaders/tests/test_http.py: 13 warnings
/usr/lib/python3/dist-packages/httpretty/core.py:1077: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
now = datetime.utcnow()
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: