Comments (8)
The readme says the project has 100% test coverage, but when I run the tests I still get 99%. It comes down to a few lines in Util's is_connection_dropped that are platform specific and therefore don't/can't get executed on a single platform.
Do you think it would be beneficial to add some tests that mock out the poll/select behavior, so 100% coverage can be reached on any platform?
from urllib3.
Unfortunately there is a lot of platform-specific code in urllib3 (grep for "# Python" and "# Platform"), and I'm not sure that mocking it out would actually improve how thoroughly it's exercised.
If the goal is just to make coverage smarter about what blocks should be ignored, then take a look at the .coveragerc file. We already do this all over the place where relevant, though I think the Util may be missing a case in some platform or another. Hmm would be nice if we could make coverage ignore only the platform-specific blocks not relevant to your current platform. Not sure that's an option, though.
By the way, which platform are you running on? Here's my output on Py27.
$ nosetests
........................................................................
Name Stmts Miss Cover Missing
------------------------------------------------------
urllib3 21 0 100%
urllib3._collections 45 0 100%
urllib3.connectionpool 168 0 100%
urllib3.contrib 0 0 100%
urllib3.exceptions 26 0 100%
urllib3.filepost 37 0 100%
urllib3.poolmanager 57 0 100%
urllib3.request 23 0 100%
urllib3.response 80 0 100%
urllib3.util 89 0 100%
------------------------------------------------------
TOTAL 546 0 100%
----------------------------------------------------------------------
Ran 72 tests in 0.778s
from urllib3.
Ah, that makes sense. I was wondering how 100% coverage was possible with the platform specific stuff.
I'm running OS X. The lines reported as not covered are related to select.poll(), which according to the comments is not supported in OS X.
$ nosetests
........................................................................
Name Stmts Miss Cover Missing
------------------------------------------------------
urllib3 21 0 100%
urllib3._collections 45 0 100%
urllib3.connectionpool 168 0 100%
urllib3.contrib 0 0 100%
urllib3.exceptions 26 0 100%
urllib3.filepost 37 0 100%
urllib3.poolmanager 57 0 100%
urllib3.request 23 0 100%
urllib3.response 80 0 100%
urllib3.util 89 5 94% 247-252
------------------------------------------------------
TOTAL 546 5 99%
----------------------------------------------------------------------
Ran 72 tests in 0.780s
Perhaps we should add that block to coverage.rc?
from urllib3.
Hmm at this point I feel like we should omit the entire is_connection_dropped
helper from coverage, since basically every line is dependent on a different platform. What do you think?
from urllib3.
That makes sense. It's certainly nicer than having # Platform-specific
on every other line :)
from urllib3.
Should be fixed now, can you confirm? :)
from urllib3.
Not excluding the helper yet--I think you need to escape the parentheses in the regex: .* # \(No coverage\)
from urllib3.
Mmm good point, want to fix it? :)
I can't verify it myself. :(
from urllib3.
Related Issues (20)
- SSL: UNEXPECTED_EOF_WHILE_READING HOT 7
- imprecise types on `urllib3.Retry.new` / `urllib3.Retry.increment` HOT 1
- Investigate CI failures with Python 3.13.0a5 HOT 2
- "unable to get local issuer certificate", even though cURL works with the same website HOT 3
- Unclosed socket warning after HTTP 407 response from HTTP CONNECT proxy HOT 1
- All Retry backoff_factor to optionally start applying from first retry HOT 4
- Retry backoff_factor offset from second retry incorrectly computed HOT 2
- HTTPConnection.request chunked=False doesn't work properly HOT 8
- Need to exception for "SSLEOFError" on python 3.10, 3.11, 3.12 HOT 3
- After upgrading to 2.2.1: 'HTTPResponse' object has no attribute 'json' HOT 1
- Comment typo settimout settimeout HOT 1
- Dependency management issue HOT 2
- Fix test_redirecting_to_bad_url failure in Requests HOT 12
- NodeJS + pyodide support HOT 1
- Retry.respect_retry_after_header=False is not honored when retry is incremented HOT 1
- Unable to build the doc `Command sphinx-build -b html -W . _build/html failed with exit code 2` HOT 1
- Sunsetting official support for Python 2
- Change log for version 1.26.19
- publish.yml uses two different versions of actions/download-artifact HOT 1
- requests > 2.31 - TypeError: unhashable type: 'list'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urllib3.