Skip to content

Commit 3da099d

Browse files
committed
Remove pytest_pycollect_makeitem.
There's only one class that requires this modification, so it can just be fixed.
1 parent 6d3610b commit 3da099d

File tree

2 files changed

+1
-27
lines changed

2 files changed

+1
-27
lines changed

conftest.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ def whitelist_check(path):
4747
}
4848

4949

50-
def is_nose_class(cls):
51-
"""Check if supplied class looks like Nose testcase"""
52-
return any(name in ['setUp', 'tearDown']
53-
for name, _ in inspect.getmembers(cls))
54-
55-
5650
def pytest_addoption(parser):
5751
group = parser.getgroup("matplotlib", "matplotlib custom options")
5852

@@ -80,23 +74,3 @@ def pytest_ignore_collect(path, config):
8074
if path.ext == '.py':
8175
collect_filter = config.getoption('--collect-filter')
8276
return COLLECT_FILTERS[collect_filter](path)
83-
84-
85-
def pytest_pycollect_makeitem(collector, name, obj):
86-
if inspect.isclass(obj):
87-
if is_nose_class(obj) and not issubclass(obj, unittest.TestCase):
88-
# Workaround unittest-like setup/teardown names in pure classes
89-
setup = getattr(obj, 'setUp', None)
90-
if setup is not None:
91-
obj.setup_method = lambda self, _: obj.setUp(self)
92-
tearDown = getattr(obj, 'tearDown', None)
93-
if tearDown is not None:
94-
obj.teardown_method = lambda self, _: obj.tearDown(self)
95-
setUpClass = getattr(obj, 'setUpClass', None)
96-
if setUpClass is not None:
97-
obj.setup_class = obj.setUpClass
98-
tearDownClass = getattr(obj, 'tearDownClass', None)
99-
if tearDownClass is not None:
100-
obj.teardown_class = obj.tearDownClass
101-
102-
return pytest.Class(name, parent=collector)

lib/matplotlib/tests/test_cbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_restrict_dict():
6868

6969

7070
class Test_delete_masked_points(object):
71-
def setUp(self):
71+
def setup_method(self):
7272
self.mask1 = [False, False, True, True, False, False]
7373
self.arr0 = np.arange(1.0, 7.0)
7474
self.arr1 = [1, 2, 3, np.nan, np.nan, 6]

0 commit comments

Comments
 (0)