Closed vkarak closed 6 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e7e93f0
) 86.67% compared to head (317fef3
) 86.66%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
The test instantiation time increases by about 5% and the overall time of the following benchmark increases by 3.5%:
reframe -c unittests/resources/checks/hellocheck.py -n ^HelloTest --repeat=1000 -l
I believe the difference comes from the fact that we now validate every assignment of a variable, whereas before we were validating once during test instantiation.
Currently, the default values of variables or the values assigned to them in the test class body are not type checked and no implicit conversions are applied to the value being assigned. This is deferred at the class instantiation time where the default values of variables are injected to the newly created test object and type checked through the associated descriptor.
This PR moves the type checking and implicit conversions, i.e., the functionality of the descriptors at the class level. We do so, with two tricks:
__set__()
return the value that the descriptor would write into the object if the object passed to__set__()
isNone
.__set_name__()
at the same time that this function is called for the variable. And it is at this point that we also call the descriptor's__set__()
method to force the type checking and any type conversion. For type conversions we do respect theallow_implicit
argument of variables.The advantages of this method are
Todos
inject()
should not be needed)setvar()
impl. for redundant operations.