Closed lmazuel closed 7 years ago
Merging #29 into master will decrease coverage by
0.52%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
- Coverage 88.86% 88.33% -0.53%
==========================================
Files 10 10
Lines 1239 1140 -99
==========================================
- Hits 1101 1007 -94
+ Misses 138 133 -5
Impacted Files | Coverage Δ | |
---|---|---|
msrest/service_client.py | 95.65% <100%> (-0.11%) |
:arrow_down: |
msrest/pipeline.py | 99.1% <100%> (+1.54%) |
:arrow_up: |
msrest/__init__.py | 60% <0%> (+1.66%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 6042cbd...e739f0d. Read the comment docs.
In current code, we create a
requests.HTTPAdapter
and assign it at instance variable of a client. At the same time, we create one session each time we have a request to do and we assign this adapter. However, look atrequests
code, theSession
object considers he has ownership of theHTTPAdapter
. In some situation, theSession
object it then closing theHTTPAdapter
. Since we keep the adapter as an instance variable, if a session closes an adapter, the new session will get the same adapter and this exception will be raised:This fixes https://github.com/Azure/azure-sdk-for-python/issues/1062
Note also that this PR fixes https://github.com/Azure/msrest-for-python/issues/4 and removes the "hook" feature and replace the few usage by the official
requests.hooks
feature (this requires too much extra work to keep our "hooks" and fix the adapter at the same time).Note finally that the Autorest tests part of this PR will break until this PR is merged: https://github.com/Azure/autorest/pull/2143