#NEWLINE# def load( file , parameter , assign ) : #NEWLINE# #INDENT# 'Loads an OK-style test from a specified filepath.\n\n    PARAMETERS:\n    file -- str; a filepath to a Python module containing OK-style\n            tests.\n\n    RETURNS:\n    Test\n    ' #NEWLINE# ( filename , ext ) = os . path . splitext ( file ) #NEWLINE# if ( ( not os . path . isfile ( file ) ) or ( ext != '.py' ) ) : #NEWLINE# #INDENT# log . info ( 'Cannot import {} as an OK test' . format ( file ) ) #NEWLINE# raise ex . LoadingException ( 'Cannot import {} as an OK test' . format ( file ) ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# test = importing . load_module ( file ) . test #NEWLINE# test = copy . deepcopy ( test ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise ex . LoadingException ( 'Error importing file {}: {}' . format ( file , str ( e ) ) ) #NEWLINE# #UNINDENT# name = os . path . basename ( filename ) #NEWLINE# try : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# name : models . OkTest ( file , SUITES , assign . endpoint , assign . cmd_args . verbose , assign . cmd_args . interactive , assign . cmd_args . timeout , ** test ) , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# except ex . SerializeException : #NEWLINE# #INDENT# raise ex . LoadingException ( 'Cannot load OK test {}' . format ( file ) )