Skip to content

Make make_deferrable available as a sanity function #1038

@vkarak

Description

@vkarak

This is quite a useful function that converts any expression or variable to a deferrable. A usage scenario is the following:

import reframe.utility.sanity as sn
from reframe.core.deferrable import make_deferrable

class SomeFlexibleTest(...):
    def __init__():
        ...
        self.sanity_patterns = sn.assert_eq(sn.count(...), make_deferrable(self.num_tasks))

num_tasks in such a case will be set at the run phase, so you need to defer its evaluation when writing the sanity patterns. Currently, you have to either import this function separately as above, or write your sanity function, e.g.,:

import reframe.utility.sanity as sn

class SomeFlexibleTest(...):
    def __init__():
        ...
        self.sanity_patterns = sn.assert_eq(sn.count(...), self.num_tasks_assigned)

    @property 
    @sn.sanity_function
    def num_tasks_assigned(self):
        return self.num_tasks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions