# Buggy code
def _mark_xfail_checks(estimator, check, pytest):
    """Mark estimator check pairs with xfail"""

    xfail_checks = _safe_tags(estimator, "_xfail_test")
    if not xfail_checks:
        return estimator, check

    check_name = _set_check_estimator_ids(check)
    msg = xfail_checks.get(check_name, None)

    if msg is None:
        return estimator, check

    return pytest.param(estimator, check, marks=pytest.mark.xfail(reason=msg))


# Traceback (TypeError)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/hooks.py:289: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py:87: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py:81: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/python.py:225: in pytest_pycollect_makeitem
res = list(collector._genfunctions(name, obj))
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/python.py:401: in _genfunctions
self.ihook.pytest_generate_tests(metafunc=metafunc)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/hooks.py:289: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py:87: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/pluggy/manager.py:81: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/python.py:128: in pytest_generate_tests
metafunc.parametrize(*marker.args, **marker.kwargs)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/python.py:993: in parametrize
function_definition=self.definition,
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/mark/structures.py:122: in _for_parametrize
parameters = cls._parse_parametrize_parameters(argvalues, force_tuple)
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/mark/structures.py:116: in _parse_parametrize_parameters
ParameterSet.extract_from(x, force_tuple=force_tuple) for x in argvalues
../../../../miniconda3/envs/py37/lib/python3.7/site-packages/_pytest/mark/structures.py:116: in <listcomp>
ParameterSet.extract_from(x, force_tuple=force_tuple) for x in argvalues
../scikit-learn/sklearn/utils/estimator_checks.py:403: in <genexpr>
for estimator, check in checks_generator)
../scikit-learn/sklearn/utils/estimator_checks.py:364: in _mark_xfail_checks
xfail_checks = _safe_tags(estimator, '_xfail_test')
../scikit-learn/sklearn/utils/estimator_checks.py:66: in _safe_tags
return estimator._get_tags().get(key, _DEFAULT_TAGS[key])
E   TypeError: _get_tags() missing 1 required positional argument: 'self'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================== 1 error in 0.39 seconds ===========================================

# Fixed code
def _mark_xfail_checks(estimator, check, pytest):
    """Mark estimator check pairs with xfail"""
    if isinstance(estimator, type):
        # try to construct estimator to get tags, if it is unable to then
        # return the estimator class
        try:
            xfail_checks = _safe_tags(_construct_instance(estimator), "_xfail_test")
        except Exception:
            return estimator, check
    else:
        xfail_checks = _safe_tags(estimator, "_xfail_test")

    if not xfail_checks:
        return estimator, check

    check_name = _set_check_estimator_ids(check)
    msg = xfail_checks.get(check_name, None)

    if msg is None:
        return estimator, check

    return pytest.param(estimator, check, marks=pytest.mark.xfail(reason=msg))