Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4bd0c5

Browse files
committed
MNT: use functools.wraps in decorator out of mild paranoia
Concern is that pytest may use the __name__ in the decorated function as part of test discovery. This does not seem to currently be true, but just in case, use `functools.wraps` to copy the name over.
1 parent d25a321 commit a4bd0c5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/matplotlib/tests/test_dates.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import dateutil.rrule
55
import numpy as np
66
import pytest
7+
import functools
78

89
from matplotlib import rc_context
910
import matplotlib.dates as mdates
@@ -160,6 +161,7 @@ def test_too_many_date_ticks(caplog):
160161

161162

162163
def _new_epoch_decorator(thefunc):
164+
@functools.wraps(thefunc)
163165
def wrapper():
164166
mdates._reset_epoch_test_example()
165167
mdates.set_epoch('2000-01-01')

0 commit comments

Comments
 (0)