-
-
Notifications
You must be signed in to change notification settings - Fork 636
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
DRY setup of WorkunitStore in Rust tests #11436
Conversation
# Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
let workunit_store = WorkunitStore::new(false); | ||
workunit_store.init_thread_state(None); | ||
|
||
WorkunitStore::setup_for_tests(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please feel free to bikeshed this method name, especially if there's something more idiomatic in Rust.
@@ -528,6 +528,12 @@ impl WorkunitStore { | |||
})) | |||
} | |||
|
|||
pub fn setup_for_tests() -> WorkunitStore { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this needs docstring. I didn't know what to put in it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it need not have one .... iff you annotate this with #[cfg(test)]
.
# Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
too bad, the Rust test runner doesn't have the notion of setup functions like other test frameworks. (There are crates that do that but this PR is good as-is.)
[ci skip-build-wheels]
[ci skip-build-wheels]