Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api_helpers): re-add falcon.api_helpers (#1904)
- Loading branch information
Showing
4 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Re-add ``api_helpers`` module that was renamed ``app_helpers``. | ||
This module is considered deprecated, and will be removed in a future Falcon version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from .app_helpers import * # NOQA | ||
|
||
# TODO deprecate | ||
# import warnings | ||
# from .util.deprecation import DeprecatedWarning | ||
|
||
# warnings.warn('The api_helpers module was renamed to app_helpers.', DeprecatedWarning) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,30 @@ | ||
from falcon import request_helpers, stream | ||
import pytest | ||
|
||
from falcon import app_helpers, request_helpers, stream | ||
|
||
# from _util import has_cython | ||
|
||
|
||
def test_bounded_stream(): | ||
assert request_helpers.Body is stream.Body | ||
assert request_helpers.BoundedStream is stream.BoundedStream | ||
|
||
|
||
class TestApiHelpers: | ||
@pytest.mark.filterwarnings('ignore:The api_helpers') | ||
def test_imports(self): | ||
from falcon import api_helpers | ||
|
||
for name in app_helpers.__all__: | ||
assert getattr(api_helpers, name) is getattr(app_helpers, name) | ||
|
||
# TODO enable test of deprecation | ||
# @pytest.mark.skipif(has_cython, reason='Reloading modules on Cython does not work') | ||
# def test_warning(self): | ||
# import importlib | ||
|
||
# from falcon.util.deprecation import DeprecatedWarning | ||
|
||
# with pytest.warns(DeprecatedWarning, match='The api_helpers'): | ||
# from falcon import api_helpers | ||
# importlib.reload(api_helpers) |