Skip to content

Commit

Permalink
Raise deprecation warning for httplib2_certs usage
Browse files Browse the repository at this point in the history
Refs #30.
  • Loading branch information
JNRowe committed Oct 13, 2019
1 parent d3d8361 commit 22a2030
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions extra/requirements-net.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
deprecation>=2.0.6
httplib2>=0.10,<0.12
3 changes: 3 additions & 0 deletions jnrbase/httplib2_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from pathlib import Path

import httplib2
from deprecation import deprecated

#: Allow fallback to bundled httplib2 certs.
#:
Expand All @@ -42,6 +43,8 @@
}


@deprecated(deprecated_in='1.2', removed_in='1.3',
details='httplib2 support is being removed')
def find_certs() -> Path:
"""Find suitable certificates for ``httplib2``.
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ filterwarnings =
error
# FIXME: This is *only* here until a new jinja release comes
ignore:Using or importing the ABCs from 'collections'.*:DeprecationWarning
ignore:find_certs is deprecated.*:deprecation.DeprecatedWarning

minversion = 4.0

[pycodestyle]
Expand Down
7 changes: 6 additions & 1 deletion tests/test_httplib2_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from pytest import mark, raises, warns

from jnrbase._version import tuple as vtuple
from jnrbase import httplib2_certs

from .utils import func_attr
Expand All @@ -46,7 +47,7 @@ def test_unbundled_package_import(monkeypatch):
def test_bundled(path_exists_force):
with warns(RuntimeWarning) as record:
httplib2_certs.find_certs()
assert 'falling back' in record[0].message.args[0]
assert 'falling back' in record[1].message.args[0]


@exists_result(False)
Expand Down Expand Up @@ -86,3 +87,7 @@ def test_curl_bundle(monkeypatch):
monkeypatch.setattr('jnrbase.httplib2_certs.Path.exists', lambda p: False)
monkeypatch.setenv('CURL_CA_BUNDLE', 'silly_platform_user')
assert httplib2_certs.find_certs() == Path('silly_platform_user')


def test_removed():
assert vtuple < (1, 3), 'httplib2 support should have been removed!'

0 comments on commit 22a2030

Please sign in to comment.