reframe-hpc/reframe

Setting variable(bool, value=True) from the command line not behaving as expected

Closed this issue · 2 comments

Hello. I'm trying to implement a test which has a concurrent = variable(bool, value=True). We are interested in overwriting this value from the command line, but I'm unable to get a value of False to be set by passing -S concurrent=no, -S concurrent=false, or -S concurrent=0.

I'm able to work around this by using a variable(str, value='True') and changing the comparisons.

This is with version 4.5.1

That's expected, check the note for the -S option:

Boolean variables in a test must be declared of type Bool and not of the built-in bool type, in order to adhere to the aforementioned behaviour. If a variable is defined as bool there is no way you can set it to False, since all strings in Python evaluate to True.

So you will have to define the variable as

import reframe.utility.typecheck as typ


class Test(...):
    concurrent = variable(typ.Bool, value=True)

Thanks! I'll update my tests.