-
Notifications
You must be signed in to change notification settings - Fork 117
[feat] Add convenience function to set a test variable only if it's undefined #2403
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
Conversation
|
Hello @vkarak, Thank you for updating! Cheers! There are no PEP8 issues in this Pull Request!Do see the ReFrame Coding Style Guide Comment last updated at 2022-02-01 16:14:18 UTC |
|
Do you think that it would make sense to add also a type(self).set_var_default('foo , 1)instead of if not type(self).is_var_defined('foo'):
self.foo = 1 |
|
Perhaps, we should better expose this functionality at the test level, so that users avoid the |
Codecov Report
@@ Coverage Diff @@
## master #2403 +/- ##
=======================================
Coverage 85.63% 85.64%
=======================================
Files 56 56
Lines 10465 10471 +6
=======================================
+ Hits 8962 8968 +6
Misses 1503 1503
Continue to review full report at Codecov.
|
|
I have hidden the metaclass stuff and I exposed a new function at the level of |
victorusu
left a comment
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
This PR adds a convenience function,
set_var_default()tocheck if a variable is defined.to set a variable in a test only if it is not already defined. This is particularly useful in library tests, when you would like to set a default in a pipeline hook and you should only do that if the user has not defined another value with the-Soption.