Skip to content

Wrong filter_param function in the parameter builtin can raise a TypeError #2118

@jjotero

Description

@jjotero

If the filter_param function passed to the parameter builtin does not return a tuple, it will raise a TypeError. This requirement should be relaxed to just require an iterable on return. If the return of the filtering function is not an iterable, a ReframeSyntaxError should be raised instead.

Currently, none of this is in the docs, so it should also be documented when this gets addressed.

Reproducer:

class Base(rfm.RunOnlyRegressionTest):
    valid_systems = ['*']
    valid_prog_environs = ['*']
    executable 'echo bananas'

    p = parameter(range(10))

    @sanity_function
    def assert_bananas(self):
        return sn.assert_found(r'bananas', self.stdout)

class Derived(Base):
    # If the filter_params function does not return a tuple, we get a TypeError
    p = parameter(inherit_params=True, filter_params=lambda x: 1)

This produces

./bin/reframe: skipping test file '/users/jjotero/reframe/tutorials/my_tests/test.py': type error: tutorials/my_tests/test.py:50: unsupported operand type(s) for +: 'int' and 'tuple' 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions