1313]
1414
1515
16- import contextlib
1716import functools
1817import glob
1918import inspect
@@ -211,7 +210,7 @@ def pipeline_hooks(cls):
211210 #: by this test.
212211 #:
213212 #: :type: :class:`List[str]`
214- #: :default: ``None ``
213+ #: :default: ``required ``
215214 #:
216215 #: .. note::
217216 #: .. versionchanged:: 2.12
@@ -223,7 +222,9 @@ def pipeline_hooks(cls):
223222 #: .. versionchanged:: 3.3
224223 #: Default value changed from ``[]`` to ``None``.
225224 #:
226- valid_prog_environs = variable (typ .List [str ], type (None ), value = None )
225+ #: .. versionchanged:: 3.6
226+ #: Default value changed from ``None`` to ``required``.
227+ valid_prog_environs = variable (typ .List [str ])
227228
228229 #: List of systems supported by this test.
229230 #: The general syntax for systems is ``<sysname>[:<partname>]``.
@@ -236,13 +237,15 @@ def pipeline_hooks(cls):
236237 #: .. versionchanged:: 3.3
237238 #: Default value changed from ``[]`` to ``None``.
238239 #:
239- valid_systems = variable (typ .List [str ], type (None ), value = None )
240+ #: .. versionchanged:: 3.6
241+ #: Default value changed from ``None`` to ``required``.
242+ valid_systems = variable (typ .List [str ])
240243
241244 #: A detailed description of the test.
242245 #:
243246 #: :type: :class:`str`
244247 #: :default: ``self.name``
245- descr = variable (str , type ( None ), value = None )
248+ descr = variable (str )
246249
247250 #: The path to the source file or source directory of the test.
248251 #:
@@ -337,7 +340,7 @@ def pipeline_hooks(cls):
337340 #:
338341 #: :type: :class:`str`
339342 #: :default: ``os.path.join('.', self.name)``
340- executable = variable (str , type ( None ), value = None )
343+ executable = variable (str )
341344
342345 #: List of options to be passed to the :attr:`executable`.
343346 #:
@@ -586,25 +589,27 @@ def pipeline_hooks(cls):
586589 #: Refer to the :doc:`ReFrame Tutorials </tutorials>` for concrete usage
587590 #: examples.
588591 #:
589- #: If set to :class:`None`, a sanity error will be raised during sanity
590- #: checking.
592+ #: If not set a sanity error will be raised during sanity checking.
591593 #:
592594 #: :type: A deferrable expression (i.e., the result of a :doc:`sanity
593- #: function </sanity_functions_reference>`) or :class:`None`
594- #: :default: :class:`None `
595+ #: function </sanity_functions_reference>`)
596+ #: :default: :class:`required `
595597 #:
596598 #: .. note::
597599 #: .. versionchanged:: 2.9
598600 #: The default behaviour has changed and it is now considered a
599- #: sanity failure if this attribute is set to :class:`None `.
601+ #: sanity failure if this attribute is set to :class:`required `.
600602 #:
601603 #: If a test doesn't care about its output, this must be stated
602604 #: explicitly as follows:
603605 #:
604606 #: ::
605607 #:
606608 #: self.sanity_patterns = sn.assert_true(1)
607- sanity_patterns = variable (_DeferredExpression , type (None ), value = None )
609+ #:
610+ #: .. versionchanged:: 3.6
611+ #: The default value has changed from ``None`` to ``required``.
612+ sanity_patterns = variable (_DeferredExpression )
608613
609614 #: Patterns for verifying the performance of this test.
610615 #:
@@ -829,14 +834,12 @@ def _rfm_init(self, name=None, prefix=None):
829834 self .name = name
830835
831836 # Pass if descr is a required variable.
832- with contextlib .suppress (AttributeError ):
833- if self .descr is None :
834- self .descr = self .name
837+ if not hasattr (self , 'descr' ):
838+ self .descr = self .name
835839
836840 # Pass if the executable is a required variable.
837- with contextlib .suppress (AttributeError ):
838- if self .executable is None :
839- self .executable = os .path .join ('.' , self .name )
841+ if not hasattr (self , 'executable' ):
842+ self .executable = os .path .join ('.' , self .name )
840843
841844 self ._perfvalues = {}
842845
@@ -1520,11 +1523,11 @@ def check_sanity(self):
15201523 sn .assert_eq (self .job .exitcode , 0 ,
15211524 msg = 'job exited with exit code {0}' )
15221525 ]
1523- if self . sanity_patterns is not None :
1526+ if hasattr ( self , 'sanity_patterns' ) :
15241527 sanity_patterns .append (self .sanity_patterns )
15251528
15261529 self .sanity_patterns = sn .all (sanity_patterns )
1527- elif self . sanity_patterns is None :
1530+ elif not hasattr ( self , 'sanity_patterns' ) :
15281531 raise SanityError ('sanity_patterns not set' )
15291532
15301533 with osext .change_dir (self ._stagedir ):
0 commit comments