def toInspect(help_mod, pkg): """ Inspect module """ toInspect = [] for m in help_mod: try: curMod = getattr(pkg, m) except Exception as e: DocInspect.print_error( 'module %s doest not exist: %s' % (m, str(e)) ) else: mod_descr = getattr(curMod, '__DESCRIPTION__') try: mod_classes = getattr(curMod, '__HELPER__') except Exception as e: mod_classes = findDecorators(module=curMod) toInspect.append( (m, mod_classes, mod_descr) ) return toInspect
def generateSutLibraries(): """ Return help for all sut libraries """ global latestlibRead2 pkg = __import__("SutLibraries") descr_pkg = getattr(pkg, '__DESCRIPTION__') for libname in pkg.__all__: latestlibRead2 = libname pkg = __import__("SutLibraries.%s" % libname) ret = [] # list of libraries for libname in pkg.__all__: if libname == "__pycache__": continue sub_mods = getattr(pkg, libname) default_libs = False generic_libs = False descr_libs = getattr(sub_mods, '__DESCRIPTION__') help_libs = getattr(sub_mods, '__HELPER__') if help_libs: ret_mod = DocInspect.inspectLibrary(package=sub_mods, modules=toInspect( help_libs, sub_mods)) # read default adapter from config file, new in v10.1 if libname == Settings.get("Default", "current-libraries"): default_libs = True # read default adapter from config file, new in v12 if libname == Settings.get("Default", "generic-libraries"): generic_libs = True # end of new cur_libs = { 'name': libname, 'type': 'libraries', 'desc': descr_libs, 'modules': ret_mod, 'is-default': default_libs, 'is-generic': generic_libs } ret.append(cur_libs) descr_pkg = { 'name': pkg.__name__, 'libraries': ret, 'type': 'package-libraries', 'desc': descr_pkg } return [descr_pkg]
def extractTestExecutor(lib): """ """ pkg = __import__("TestExecutorLib.%s" % lib) descr_pkg = getattr(pkg, '__DESCRIPTION__') lib_obj = getattr(pkg, lib) lib_descr = getattr(lib_obj, '__DESCRIPTION__') classes = findDecorators(lib_obj) pkgDesc = DocInspect.describePackage( pkg, modules=[ ( lib, classes, lib_descr ) ], descr=descr_pkg ) return pkgDesc
def extractTestExecutor(lib): """ """ pkg_te = __import__("ea.testexecutorlib", fromlist=[lib]) descr_pkg = getattr(pkg_te, '__DESCRIPTION__') lib_obj = getattr(pkg_te, lib) lib_descr = getattr(lib_obj, '__DESCRIPTION__') classes = getattr(lib_obj, '__HELPER__') pkg_desc = DocInspect.describePackage(pkg_te, modules=[(lib, classes, lib_descr)], descr=descr_pkg) return pkg_desc
def generateTestInteropLib(): """ """ pkg = __import__("TestInteropLib") description = getattr(pkg, '__DESCRIPTION__') helper = findDecorators(pkg) classes = [] pkgDesc = {} for h in helper: pkgDesc = DocInspect.describePackage( pkg, modules=[ h ], descr=description ) classes.append( pkgDesc['modules'][0] ) # fix some values pkgDesc['name'] = 'TestInteroperability' # original name = TestInteropLib pkgDesc['modules'] = classes return [ pkgDesc ]
@param file: @type file: """ fd = open(file, 'wb') fd.write(pickle.dumps(data)) fd.close() if __name__ == "__main__": if eval(check_syntax_only): return_code = 0 try: pkg = __import__("SutAdapters") except Exception as e: return_code = 1 DocInspect.print_error('error to import sut adapters: %s' % str(e)) sys.exit(return_code) elif eval(check_syntax_sutlib_only): return_code = 0 try: pkg = __import__("SutLibraries") except Exception as e: return_code = 1 DocInspect.print_error('error to import sut libraries: %s' % str(e)) sys.exit(return_code) else: return_code = 0 # initialize settings