Skip to content
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

Use UserWarning for old callback, as DeprecationWarning is not visible #6270

Merged
merged 2 commits into from Oct 22, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion python-package/xgboost/training.py
Expand Up @@ -14,7 +14,7 @@ def _configure_deprecated_callbacks(
verbose_eval, early_stopping_rounds, maximize, start_iteration,
num_boost_round, feval, evals_result, callbacks, show_stdv, cvfolds):
link = 'https://xgboost.readthedocs.io/en/latest/python/callbacks.html'
warnings.warn(f'Old style callback is deprecated. See: {link}', DeprecationWarning)
warnings.warn(f'Old style callback is deprecated. See: {link}', UserWarning)
# Most of legacy advanced options becomes callbacks
if early_stopping_rounds is not None:
callbacks.append(callback.early_stop(early_stopping_rounds,
Expand Down
6 changes: 3 additions & 3 deletions tests/python/test_callback.py
Expand Up @@ -191,17 +191,17 @@ def eta_decay(ithround, num_boost_round=num_round):
assert eval_errors_3[i] != eval_errors_2[i]

def test_eta_decay_hist(self):
with pytest.deprecated_call():
with pytest.warns(UserWarning):
self.run_eta_decay('hist', True)
self.run_eta_decay('hist', False)

def test_eta_decay_approx(self):
with pytest.deprecated_call():
with pytest.warns(UserWarning):
self.run_eta_decay('approx', True)
self.run_eta_decay('approx', False)

def test_eta_decay_exact(self):
with pytest.deprecated_call():
with pytest.warns(UserWarning):
self.run_eta_decay('exact', True)
self.run_eta_decay('exact', False)

Expand Down