Skip to content

Commit 1e4c50a

Browse files
WillAydjreback
authored andcommitted
Test Decorators and Better Pytest Integration in 'test_excel' (pandas-dev#19829)
1 parent 960a746 commit 1e4c50a

File tree

4 files changed

+739
-902
lines changed

4 files changed

+739
-902
lines changed

pandas/compat/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,20 @@ def callable(obj):
365365
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
366366

367367

368+
if sys.version_info[0] < 3:
369+
# In PY2 functools.wraps doesn't provide metadata pytest needs to generate
370+
# decorated tests using parametrization. See pytest GH issue #2782
371+
def wraps(wrapped, assigned=functools.WRAPPER_ASSIGNMENTS,
372+
updated=functools.WRAPPER_UPDATES):
373+
def wrapper(f):
374+
f = functools.wraps(wrapped, assigned, updated)(f)
375+
f.__wrapped__ = wrapped
376+
return f
377+
return wrapper
378+
else:
379+
wraps = functools.wraps
380+
381+
368382
def add_metaclass(metaclass):
369383
"""Class decorator for creating a class with a metaclass."""
370384
def wrapper(cls):

0 commit comments

Comments
 (0)