Skip to content

Commit 4f5c5ca

Browse files
committed
Get test suite passing on 2.7.
1. Rename issue_85_module so that it is not collected by pytest. 2. Use the signature polyfill rather than inspect.signature.
1 parent 9c54231 commit 4f5c5ca

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

tests/test_issues.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def second_wrapper(foo, bar):
182182
return wrapper(foo) + bar
183183

184184
assert second_wrapper.__wrapped__ is wrapper
185-
assert "bar" in inspect.signature(second_wrapper).parameters
185+
assert "bar" in signature(second_wrapper).parameters
186186
assert second_wrapper(1, -1) == 0
187187

188188

@@ -258,19 +258,19 @@ def test_issue_77_async_generator_partial():
258258
@pytest.mark.skipif(sys.version_info < (3, 7, 6), reason="The __wrapped__ behavior in get_type_hints being tested was not added until python 3.7.6.")
259259
def test_issue_85_wrapped_forwardref_annotation():
260260
import typing
261-
from . import issue_85_module
261+
from . import _issue_85_module
262262

263-
@wraps(issue_85_module.forwardref_method, remove_args=["bar"])
263+
@wraps(_issue_85_module.forwardref_method, remove_args=["bar"])
264264
def wrapper(**kwargs):
265265
kwargs["bar"] = "x" # python 2 syntax to prevent syntax error.
266-
return issue_85_module.forwardref_method(**kwargs)
266+
return _issue_85_module.forwardref_method(**kwargs)
267267

268268
# Make sure the wrapper function works as expected
269-
assert wrapper(issue_85_module.ForwardRef()).x == "defaultx"
269+
assert wrapper(_issue_85_module.ForwardRef()).x == "defaultx"
270270

271271
# Check that the type hints of the wrapper are ok with the forward reference correctly resolved
272272
expected_annotations = {
273-
"foo": issue_85_module.ForwardRef,
274-
"return": issue_85_module.ForwardRef,
273+
"foo": _issue_85_module.ForwardRef,
274+
"return": _issue_85_module.ForwardRef,
275275
}
276276
assert typing.get_type_hints(wrapper) == expected_annotations

0 commit comments

Comments
 (0)