This will avoid catching AttributeErrors when importing, and only catch them if mod.profile doesn't exist.
Signed-off-by: Dylan Baker <[email protected]> --- framework/profile.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/framework/profile.py b/framework/profile.py index cf8b2dd..6db65f1 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -356,15 +356,18 @@ def load_test_profile(filename): try: mod = importlib.import_module('tests.{0}'.format( os.path.splitext(os.path.basename(filename))[0])) + except ImportError: + raise exceptions.PiglitFatalError( + 'Failed to import "{}", there is either something wrong with the ' + 'module or it doesn\'t exist. Check your spelling?'.format( + filename)) + + try: return mod.profile except AttributeError: raise exceptions.PiglitFatalError( - 'There is not profile attribute in module {}.\n' + 'There is no "profile" attribute in module {}.\n' 'Did you specify the right file?'.format(filename)) - except ImportError: - raise exceptions.PiglitFatalError( - 'There is no test profile called "{}".\n' - 'Check your spelling?'.format(filename)) def run(profiles, logger, backend, concurrency): -- git-series 0.8.10 _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
