Skip to content

Commit 09b9cc8

Browse files
committed
Document alias variables
1 parent 3a4c093 commit 09b9cc8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

reframe/core/variables.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,37 @@ class MyRequiredTest(HelloTest):
158158
from :class:`EchoBaseTest` to throw an error indicating that the variable
159159
``what`` has not been set.
160160
161+
Finally, variables may alias each other. If a variable is an alias of
162+
another one it behaves in the exact same way as its target. If a change is
163+
made to the target variable, this is reflected to the alias and vice
164+
versa. However, alias variables are independently loggable: an alias may
165+
be logged but not its target and vice versa. Aliased variables are useful
166+
when you want to rename a variable and you want to keep the old one for
167+
compatibility reasons.
168+
161169
:param `types`: the supported types for the variable.
162170
:param value: the default value assigned to the variable. If no value is
163171
provided, the variable is set as ``required``.
164172
:param field: the field validator to be used for this variable. If no
165173
field argument is provided, it defaults to
166174
:attr:`reframe.core.fields.TypedField`. The provided field validator
167175
by this argument must derive from :attr:`reframe.core.fields.Field`.
176+
:param alias: the target variable if this variable is an alias. This must
177+
refer to an already declared variable and neither default value nor a
178+
field can be specified for an alias variable.
168179
:param loggable: Mark this variable as loggable. If :obj:`True`, this
169180
variable will become a log record attribute under the name
170181
``check_NAME``, where ``NAME`` is the name of the variable.
171182
:param `kwargs`: keyword arguments to be forwarded to the constructor of
172183
the field validator.
173184
:returns: A new test variable.
174185
175-
.. version added:: 3.10.2
186+
.. versionadded:: 3.10.2
176187
The ``loggable`` argument is added.
177188
189+
.. versionadded:: 4.0.0
190+
Alias variable are introduced.
191+
178192
'''
179193

180194
# NOTE: We can't use truly private fields in `__slots__`, because

0 commit comments

Comments
 (0)