Skip to content

Commit

Permalink
Prefix special (generated) parameters with . instead of $
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarak committed Nov 29, 2024
1 parent 2e3dee8 commit 465ec1c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ The way the tests are generated and how they interact with the test filtering op

Parameterize a test on an existing variable.

This option will create a new test with a parameter named ``$VAR`` with the values given in the comma-separated list ``VAL0,VAL1,...``.
The test will behave as if the variable ``VAR`` was a paramter taking the values ``VAL0,VAL1,...``.
The values will be converted based on the type of the target variable ``VAR``.
The ``TEST.`` prefix will only parameterize the variable ``VAR`` of test ``TEST``.

Expand Down
16 changes: 8 additions & 8 deletions reframe/frontend/testgenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ def _generate_tests(testcases, gen_fn):
@time_function
def distribute_tests(testcases, node_map):
def _rfm_pin_run_nodes(obj):
nodelist = getattr(obj, '$nid')
nodelist = getattr(obj, '.nid')
if not obj.local:
obj.job.pin_nodes = nodelist

def _rfm_pin_build_nodes(obj):
pin_nodes = getattr(obj, '$nid')
pin_nodes = getattr(obj, '.nid')
if obj.build_job and not obj.local and not obj.build_locally:
obj.build_job.pin_nodes = pin_nodes

Expand All @@ -99,9 +99,9 @@ def _rfm_set_valid_systems(obj):
'valid_systems': [partition.fullname],
# We add a partition parameter so as to differentiate the test
# in case another test has the same nodes in another partition
'$part': builtins.parameter([partition.fullname],
'.part': builtins.parameter([partition.fullname],
loggable=False),
'$nid': builtins.parameter(
'.nid': builtins.parameter(
[[n] for n in node_map[partition.fullname]],
fmt=util.nodelist_abbrev, loggable=False
)
Expand All @@ -113,7 +113,7 @@ def _rfm_set_valid_systems(obj):
# will not be overwritten by a parent post-init hook
builtins.run_after('init')(_rfm_set_valid_systems),
]
), ['$part', '$nid']
), ['.part', '.nid']

return _generate_tests(testcases, _make_dist_test)

Expand All @@ -127,10 +127,10 @@ def _make_repeat_test(testcase):
return make_test(
cls.__name__, (cls,),
{
'$repeat_no': builtins.parameter(range(num_repeats),
'.repeat_no': builtins.parameter(range(num_repeats),
loggable=False)
}
), ['$repeat_no']
), ['.repeat_no']

return _generate_tests(testcases, _make_repeat_test)

Expand Down Expand Up @@ -164,7 +164,7 @@ def _make_parameterized_test(testcase):
)
continue

body[f'${var}'] = builtins.parameter(values, loggable=False)
body[f'.{var}'] = builtins.parameter(values, loggable=False)

def _set_vars(self):
for var in body.keys():
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_testgenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def sys0p0_nodes():

nodelist_iter = sys0p0_nodes()
for tc in new_cases:
nodes = getattr(tc.check, '$nid')
nodes = getattr(tc.check, '.nid')
if tc.partition.fullname == 'sys0:p0':
assert nodes == next(nodelist_iter)
else:
Expand Down

0 comments on commit 465ec1c

Please sign in to comment.