@@ -138,14 +138,49 @@ class RegressionTest(RegressionMixin, jsonext.JSONSerializable):
138138 This class provides the implementation of the pipeline phases that the
139139 regression test goes through during its lifetime.
140140
141- .. warning::
142- .. versionchanged:: 3.4.2
143- Multiple inheritance with a shared common ancestor is not allowed.
141+ This class accepts parameters at the *class definition*, i.e., the test
142+ class can be defined as follows:
143+
144+ .. code-block:: python
145+
146+ class MyTest(RegressionTest, param='foo', ...):
147+
148+ where ``param`` is one of the following:
149+
150+ :param pin_prefix: lock the test prefix to the directory where the current
151+ class lives.
152+
153+ :param require_version: a list of ReFrame version specifications that this
154+ test is allowed to run. A version specification string can have one of
155+ the following formats:
156+
157+ - ``VERSION``: Specifies a single version.
158+ - ``{OP}VERSION``, where ``{OP}`` can be any of ``>``, ``>=``, ``<``,
159+ ``<=``, ``==`` and ``!=``. For example, the version specification
160+ string ``'>=3.5.0'`` will allow the following test to be loaded
161+ only by ReFrame 3.5.0 and higher. The ``==VERSION`` specification
162+ is the equivalent of ``VERSION``.
163+ - ``V1..V2``: Specifies a range of versions.
164+
165+ The test will be selected if *any* of the versions is satisfied, even
166+ if the versions specifications are conflicting.
167+
168+ :param special: allow pipeline stage methods to be overriden in this class.
144169
145170 .. note::
146171 .. versionchanged:: 2.19
147172 Base constructor takes no arguments.
148173
174+ .. versionadded:: 3.3
175+ The ``pin_prefix`` class definition parameter is added.
176+
177+ .. versionadded:: 3.7.0
178+ The ``require_verion`` class definition parameter is added.
179+
180+ .. warning::
181+ .. versionchanged:: 3.4.2
182+ Multiple inheritance with a shared common ancestor is not allowed.
183+
149184 '''
150185
151186 def disable_hook (self , hook_name ):
@@ -805,10 +840,16 @@ def __getattribute__(self, name):
805840 return super ().__getattribute__ (name )
806841
807842 @classmethod
808- def __init_subclass__ (cls , * , special = False , pin_prefix = False , ** kwargs ):
843+ def __init_subclass__ (cls , * , special = False , pin_prefix = False ,
844+ require_version = None , ** kwargs ):
809845 super ().__init_subclass__ (** kwargs )
810846 cls ._rfm_override_final = special
811847
848+ if require_version :
849+ cls ._rfm_required_version = require_version
850+ elif not hasattr (cls , '_rfm_required_version' ):
851+ cls ._rfm_required_version = []
852+
812853 # Insert the prefix to pin the test to if the test lives in a test
813854 # library with resources in it.
814855 if pin_prefix :
0 commit comments