77
88import collections
99import inspect
10+ import sys
1011import traceback
1112
1213import reframe
13- from reframe .core .exceptions import ReframeSyntaxError
14+ from reframe .core .exceptions import ReframeSyntaxError , user_frame
1415from reframe .core .logging import getlogger
1516from reframe .core .pipeline import RegressionTest
1617from reframe .utility .versioning import Version , VersionValidator
1718
1819
1920def _register_test (cls , args = None ):
20- def _instantiate ():
21+ def _instantiate (cls , args ):
22+ if isinstance (args , collections .Sequence ):
23+ return cls (* args )
24+ elif isinstance (args , collections .Mapping ):
25+ return cls (** args )
26+ elif args is None :
27+ return cls ()
28+
29+ def _instantiate_all ():
2130 ret = []
2231 for cls , args in mod .__rfm_test_registry :
2332 try :
@@ -28,23 +37,19 @@ def _instantiate():
2837 mod .__rfm_skip_tests = set ()
2938
3039 try :
31- if isinstance (args , collections .Sequence ):
32- ret .append (cls (* args ))
33- elif isinstance (args , collections .Mapping ):
34- ret .append (cls (** args ))
35- elif args is None :
36- ret .append (cls ())
40+ _instantiate (cls , args )
3741 except Exception as e :
38- getlogger ().error ('%s:%s: skipping due to errors; check log'
39- 'file for more information.' %
40- (inspect .getfile (cls ), cls .__name__ ))
41- getlogger ().debug (traceback .format_exc ())
42+ frame = user_frame (sys .exc_info ()[2 ])
43+ msg = 'skipping test due to errors: %s\n ' % cls .__name__
44+ msg += ' %s:%s' % (frame .filename , frame .lineno )
45+ getlogger ().warning (msg )
46+ getlogger ().verbose (traceback .format_exc ())
4247
4348 return ret
4449
4550 mod = inspect .getmodule (cls )
4651 if not hasattr (mod , '_rfm_gettests' ):
47- mod ._rfm_gettests = _instantiate
52+ mod ._rfm_gettests = _instantiate_all
4853
4954 try :
5055 mod .__rfm_test_registry .append ((cls , args ))
0 commit comments