How to use find_gwt_dir method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...31 for file in os.listdir(project_path):32 if file.endswith('.gwt.xml'):33 projects[project].append(file[:-8])34 return projects35def find_gwt_dir():36 """See if GWT is installed in site-packages or in the system,37 site-packages is favored over a system install or a /usr/local install.38 """39 site_gwt = os.path.join(_AUTOTEST_DIR, 'site-packages', 'gwt')40 gwt_dirs = [site_gwt] + _DEFAULT_GWT_DIRS41 for gwt_dir in gwt_dirs:42 if os.path.isdir(gwt_dir):43 return gwt_dir44 logging.error('Unable to find GWT. '45 'You can use utils/ to install it.')46 sys.exit(1)47def install_completed_client(compiled_dir, project_client):48 """Remove old client directory if it exists, move installed client to the49 old directory and move newly compield client to the installed client50 dir.51 @param compiled_dir: Where the new client was compiled52 @param project_client: project.client pair e.g. autotest.AfeClient53 @returns True if installation was successful or False if it failed54 """55 tmp_client_dir = os.path.join(_TMP_COMPILE_DIR, project_client)56 install_dir = os.path.join(_DEFAULT_INSTALL_DIR, project_client)57 old_install_dir = os.path.join(_DEFAULT_INSTALL_DIR,58 project_client + '.old')59 if not os.path.exists(_DEFAULT_INSTALL_DIR):60 os.mkdir(_DEFAULT_INSTALL_DIR)61 if os.path.isdir(tmp_client_dir):62 if os.path.isdir(old_install_dir):63 shutil.rmtree(old_install_dir)64 if os.path.isdir(install_dir):65 os.rename(install_dir, old_install_dir)66 try:67 os.rename(tmp_client_dir, install_dir)68 return True69 except Exception, err:70 # If we can't rename the client raise an exception71 # and put the old client back72 shutil.rmtree(install_dir)73 shutil.copytree(old_install_dir, install_dir)74 logging.error('Copying old client: %s', err)75 else:76 logging.error('Compiled directory is gone, something went wrong')77 return False78def compile_and_install_client(project_client, extra_args='',79 install_client=True):80 """Compile the client into a temporary directory, if successful81 call install_completed_client to install the new client.82 @param project_client: project.client pair e.g. autotest.AfeClient83 @param install_client: Boolean, if True install the clients84 @return True if install and compile was successful False if it failed85 """86 java_args = {}87 java_args['compile_dir'] = _TMP_COMPILE_DIR88 java_args['app_dir'] = _DEFAULT_APP_DIR89 java_args['gwt_dir'] = find_gwt_dir()90 java_args['extra_args'] = extra_args91 java_args['project_client'] = project_client92 cmd = _COMPILE_LINE % java_args93'Compiling client %s', project_client)94 try:95, verbose=True)96 if install_client:97 return install_completed_client(java_args['compile_dir'],98 project_client)99 return True100 except error.CmdError:101 logging.error('Error compiling %s, leaving old client', project_client)102 return False103def compile_all_projects(extra_args=''):...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?