Azure / msrest-for-python

The runtime library "msrest" for AutoRest generated Python clients.
MIT License
41 stars 64 forks source link

Failing tests with Python 3.12 #261

Open fabaff opened 8 months ago

fabaff commented 8 months ago

Some tests are failing with Python 3.12 while they are passing with Python 3.11.

============================= test session starts ==============================
platform linux -- Python 3.12.1, pytest-7.4.4, pluggy-1.4.0
rootdir: /build/source
configfile: setup.cfg
plugins: aiohttp-1.0.5, asyncio-0.21.1
asyncio: mode=Mode.STRICT
collected 210 items / 8 deselected / 202 selected                              

tests/test_auth.py F..FFF.                                               [  3%]
tests/test_client.py ...........                                         [  8%]
tests/test_exceptions.py ..                                              [  9%]
tests/test_paging.py .....                                               [ 12%]
tests/test_pipeline.py .....                                             [ 14%]
tests/test_polling.py ....                                               [ 16%]
tests/test_requests_universal.py ....                                    [ 18%]
tests/test_runtime.py ...............                                    [ 26%]
tests/test_serialization.py ............................................ [ 48%]
.......................................                                  [ 67%]
tests/test_universal_pipeline.py ...                                     [ 68%]
tests/test_xml_serialization.py ........................................ [ 88%]
...........                                                              [ 94%]
tests/asynctests/test_async_client.py ..                                 [ 95%]
tests/asynctests/test_async_paging.py .....                              [ 97%]
tests/asynctests/test_pipeline.py .                                      [ 98%]
tests/asynctests/test_polling.py ....                                    [100%]

=================================== FAILURES ===================================
_____________________ TestAuthentication.test_apikey_auth ______________________

self = <tests.test_auth.TestAuthentication testMethod=test_apikey_auth>

    def test_apikey_auth(self):
        auth = ApiKeyCredentials(
            in_headers={
                'testheader' : 'testheadervalue'
            }
        )
        session = auth.signed_session()
        prep_req = session.prepare_request(self.request)
>       self.assertDictContainsSubset({'testheader' : 'testheadervalue'}, prep_req.headers)
E       AttributeError: 'TestAuthentication' object has no attribute 'assertDictContainsSubset'

tests/test_auth.py:114: AttributeError
_______________________ TestAuthentication.test_cs_auth ________________________

self = <tests.test_auth.TestAuthentication testMethod=test_cs_auth>

    def test_cs_auth(self):
        auth = CognitiveServicesCredentials("mysubkey")
        session = auth.signed_session()
        prep_req = session.prepare_request(self.request)
>       self.assertDictContainsSubset({'Ocp-Apim-Subscription-Key' : 'mysubkey'}, prep_req.headers)
E       AttributeError: 'TestAuthentication' object has no attribute 'assertDictContainsSubset'

tests/test_auth.py:129: AttributeError
____________________ TestAuthentication.test_eventgrid_auth ____________________

self = <tests.test_auth.TestAuthentication testMethod=test_eventgrid_auth>

    def test_eventgrid_auth(self):
        auth = TopicCredentials("mytopickey")
        session = auth.signed_session()
        prep_req = session.prepare_request(self.request)
>       self.assertDictContainsSubset({'aeg-sas-key' : 'mytopickey'}, prep_req.headers)
E       AttributeError: 'TestAuthentication' object has no attribute 'assertDictContainsSubset'

tests/test_auth.py:135: AttributeError
________________ TestAuthentication.test_eventgrid_domain_auth _________________

self = <tests.test_auth.TestAuthentication testMethod=test_eventgrid_domain_auth>

    def test_eventgrid_domain_auth(self):
        auth = DomainCredentials("mydomainkey")
        session = auth.signed_session()
        prep_req = session.prepare_request(self.request)
>       self.assertDictContainsSubset({'aeg-sas-key' : 'mydomainkey'}, prep_req.headers)
E       AttributeError: 'TestAuthentication' object has no attribute 'assertDictContainsSubset'

tests/test_auth.py:141: AttributeError
=============================== warnings summary ===============================
tests/test_client.py::TestServiceClient::test_client_request
tests/test_client.py::TestServiceClient::test_deprecated_creds
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_3_times
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_404
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_408
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_501
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_502
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_505
tests/test_runtime.py::TestRuntimeRetry::test_request_retry_max
  /build/source/msrest/service_client.py:259: DeprecationWarning: Creds parameter is deprecated. Set config.credentials instead.
    warnings.warn("Creds parameter is deprecated. Set config.credentials instead.",

tests/test_runtime.py: 31 warnings
  /nix/store/aqx5gpnblac0dz6dajvv2aj4hxlxpixq-python3.12-httpretty-1.1.4/lib/python3.12/site-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()

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================= slowest 10 durations =============================
2.00s call     tests/asynctests/test_polling.py::test_poller
1.00s call     tests/test_polling.py::test_poller
0.04s call     tests/test_client.py::TestServiceClient::test_client_send
0.04s call     tests/test_client.py::TestServiceClient::test_deprecated_creds
0.03s call     tests/asynctests/test_async_client.py::TestServiceClient::test_client_send
0.03s call     tests/test_client.py::TestServiceClient::test_format_url
0.02s call     tests/test_client.py::TestServiceClient::test_client_request
0.02s call     tests/test_client.py::TestServiceClient::test_keep_alive
0.02s call     tests/test_client.py::TestServiceClient::test_context_manager
0.02s call     tests/test_client.py::TestServiceClient::test_sdk_context_manager
=========================== short test summary info ============================
FAILED tests/test_auth.py::TestAuthentication::test_apikey_auth - AttributeError: 'TestAuthentication' object has no attribute 'assertDictCon...
FAILED tests/test_auth.py::TestAuthentication::test_cs_auth - AttributeError: 'TestAuthentication' object has no attribute 'assertDictCon...
FAILED tests/test_auth.py::TestAuthentication::test_eventgrid_auth - AttributeError: 'TestAuthentication' object has no attribute 'assertDictCon...
FAILED tests/test_auth.py::TestAuthentication::test_eventgrid_domain_auth - AttributeError: 'TestAuthentication' object has no attribute 'assertDictCon...
=========== 4 failed, 198 passed, 8 deselected, 40 warnings in 4.33s ===========