Skip to content

Remove pytest_pycollect_makeitem. #8002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ def whitelist_check(path):
}


def is_nose_class(cls):
"""Check if supplied class looks like Nose testcase"""
return any(name in ['setUp', 'tearDown']
for name, _ in inspect.getmembers(cls))


def pytest_addoption(parser):
group = parser.getgroup("matplotlib", "matplotlib custom options")

Expand Down Expand Up @@ -80,23 +74,3 @@ def pytest_ignore_collect(path, config):
if path.ext == '.py':
collect_filter = config.getoption('--collect-filter')
return COLLECT_FILTERS[collect_filter](path)


def pytest_pycollect_makeitem(collector, name, obj):
if inspect.isclass(obj):
if is_nose_class(obj) and not issubclass(obj, unittest.TestCase):
# Workaround unittest-like setup/teardown names in pure classes
setup = getattr(obj, 'setUp', None)
if setup is not None:
obj.setup_method = lambda self, _: obj.setUp(self)
tearDown = getattr(obj, 'tearDown', None)
if tearDown is not None:
obj.teardown_method = lambda self, _: obj.tearDown(self)
setUpClass = getattr(obj, 'setUpClass', None)
if setUpClass is not None:
obj.setup_class = obj.setUpClass
tearDownClass = getattr(obj, 'tearDownClass', None)
if tearDownClass is not None:
obj.teardown_class = obj.tearDownClass

return pytest.Class(name, parent=collector)
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_cbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_restrict_dict():


class Test_delete_masked_points(object):
def setUp(self):
def setup_method(self):
self.mask1 = [False, False, True, True, False, False]
self.arr0 = np.arange(1.0, 7.0)
self.arr1 = [1, 2, 3, np.nan, np.nan, 6]
Expand Down