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

[R-package] [tests] reduce verbosity in unit tests #4862

Closed
jameslamb opened this issue Dec 6, 2021 · 1 comment · Fixed by #5250
Closed

[R-package] [tests] reduce verbosity in unit tests #4862

jameslamb opened this issue Dec 6, 2021 · 1 comment · Fixed by #5250

Comments

@jameslamb
Copy link
Collaborator

Summary

Unit tests in the R package which are not explicitly testing {lightgbm}'s behavior for different values of the parameter verbose should use verbose = -1L to suppress all other log outputs.

Motivation

Suppressing more log output in tests may make them faster by reducing the number of times the package has to write to stdout / stderr.

It will also improve the usability of the logs for quickly identifying where issues happened.

Description

This work should be done in multiple small pull requests, not one huge one changing all tests.

It should be possible to override the value of verbose should be using an environment variable, so that developers can occasionally, easily run the tests in "debug" mode if additional logs are needed to identify issues.

Maybe like this:

LGB_TEST_VERBOSITY <- as.integer(Sys.getenv("LGB_TEST_VERBOSITY", "-1"))

test_that("some test", {
    params = list(verbose = LGB_TEST_VERBOSITY)
    ...
})

References

Created from this comment: #4567 (review)

@jameslamb jameslamb self-assigned this Apr 3, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed.
To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues
including a reference to this.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant