Skip to content

Commit

Permalink
Added wraps to compat for Py27 testing
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Feb 22, 2018
1 parent d471174 commit f5bc0ba
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions pandas/compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,18 @@ def callable(obj):
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)


if sys.version_info[0:2] < (3, 4):
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
updated=functools.WRAPPER_UPDATES):
def wrapper(f):
f = functools.wraps(wrapped, assigned, updated)(f)
f.__wrapped__ = wrapped
return f
return wrapper
else:
wraps = functools.wraps


def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
Expand Down
2 changes: 1 addition & 1 deletion pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2165,7 +2165,7 @@ def network(t, url="http://www.google.com",
from pytest import skip
t.network = True

@wraps(t)
@compat.wraps(t)
def wrapper(*args, **kwargs):
if check_before_test and not raise_on_error:
if not can_connect(url, error_classes):
Expand Down

0 comments on commit f5bc0ba

Please sign in to comment.