Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dozens of STDERR lines about InsecurePlatformWarning when running tests #13

Open
pdurbin opened this issue Apr 15, 2015 · 4 comments
Open

Comments

@pdurbin
Copy link
Member

pdurbin commented Apr 15, 2015

I'm getting dozens of InsecurePlatformWarning's when I run the tests on the system Python on my Mac.

I took a quick look at https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning but I'm not sure what we should advise people to do in the readme. All the solutions seem a bit complicated to me. If we can change our code a bit that might be nice (rather than requiring that people install a newer version of Python).

$ python -m unittest test_dataverse 2>&1 | grep InsecurePlatformWarning | sort | uniq -c
  87   InsecurePlatformWarning
   1 ../Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
   5 ./Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
   1 .s/Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  80 /Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
$ python --version
Python 2.7.6
$ sw_vers 
ProductName:    Mac OS X
ProductVersion: 10.10.3
BuildVersion:   14D131
@pdurbin
Copy link
Member Author

pdurbin commented Apr 15, 2015

My hack was to edit the file with vim /Users/pdurbin/.virtualenvs/dataverse-client-python/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py +79 and comment out the warning. :)

@rliebz
Copy link
Contributor

rliebz commented Apr 16, 2015

I'm actually not getting those warnings on my Mac (running 2.7.6), but I'm not sure why.

If you don't want the warnings to show up in the tests, it should be as easy as putting this at the top of dataverse/test/test_dataverse.py:

from requests.packages import urllib3
urllib3.disable_warnings()

@cryptid11
Copy link

thanks @rliebz that works for me, but still doesn't get the reason of the warnings... (I get it with other code, find this git through google)

@rliebz
Copy link
Contributor

rliebz commented Apr 28, 2015

I've silenced the warnings in the master branch using the method I described for the time being, but I'm leaving the issue open so that we can keep track of this and potentially come up with a safer solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants