How to use _install_using_packaging method in autotest

Best Python code snippet using autotest_python Github


Full Screen

...99 self._install(host=host, autodir=autodir, use_autoserv=False,100 use_packaging=False)101 def install_no_autoserv(self, host=None, autodir=None):102 self._install(host=host, autodir=autodir, use_autoserv=False)103 def _install_using_packaging(self, host, autodir):104 c = global_config.global_config105 repos = c.get_config_value("PACKAGES", 'fetch_location', type=list,106 default=[])107 repos.reverse()108 if not repos:109 raise error.PackageInstallError("No repos to install an "110 "autotest client from")111 pkgmgr = packages.PackageManager(autodir, hostname=host.hostname,112 repo_urls=repos,113 do_locking=False,114,115 run_function_dargs=dict(timeout=600))116 # The packages dir is used to store all the packages that117 # are fetched on that client. (for the tests,deps etc.118 # too apart from the client)119 pkg_dir = os.path.join(autodir, 'packages')120 # clean up the autodir except for the packages directory121'cd %s && ls | grep -v "^packages$"'122 ' | xargs rm -rf && rm -rf .[^.]*' % autodir)123 pkgmgr.install_pkg('autotest', 'client', pkg_dir, autodir,124 preserve_install_dir=True)125 self.installed = True126 def _install_using_send_file(self, host, autodir):127 dirs_to_exclude = set(["tests", "site_tests", "deps", "profilers"])128 light_files = [os.path.join(self.source_material, f)129 for f in os.listdir(self.source_material)130 if f not in dirs_to_exclude]131 host.send_file(light_files, autodir, delete_dest=True)132 # create empty dirs for all the stuff we excluded133 commands = []134 for path in dirs_to_exclude:135 abs_path = os.path.join(autodir, path)136 abs_path = utils.sh_escape(abs_path)137 commands.append("mkdir -p '%s'" % abs_path)138 commands.append("touch '%s'/" % abs_path)139';'.join(commands))140 def _install(self, host=None, autodir=None, use_autoserv=True,141 use_packaging=True):142 """143 Install autotest. If get() was not called previously, an144 attempt will be made to install from the autotest svn145 repository.146 @param host A Host instance on which autotest will be installed147 @param autodir Location on the remote host to install to148 @param use_autoserv Enable install modes that depend on the client149 running with the autoserv harness150 @param use_packaging Enable install modes that use the packaging system151 @exception AutoservError if a tarball was not specified and152 the target host does not have svn installed in its path153 """154 if not host:155 host = self.host156 if not self.get()158 host.wait_up(timeout=30)159 host.setup()160"Installing autotest on %s", host.hostname)161 # set up the autotest directory on the remote machine162 if not autodir:163 autodir = self.get_install_dir(host)164'Using installation dir %s', autodir)165 host.set_autodir(autodir)166'mkdir -p %s' % utils.sh_escape(autodir))167 # make sure there are no files in $AUTODIR/results168 results_path = os.path.join(autodir, 'results')169'rm -rf %s/*' % utils.sh_escape(results_path),170 ignore_status=True)171 # Fetch the autotest client from the nearest repository172 if use_packaging:173 try:174 self._install_using_packaging(host, autodir)175 return176 except (error.PackageInstallError, error.AutoservRunError,177 global_config.ConfigError), e:178"Could not install autotest using the packaging "179 "system: %s. Trying other methods", e)180 # try to install from file or directory181 if self.source_material:182 c = global_config.global_config183 supports_autoserv_packaging = c.get_config_value(184 "PACKAGES", "serve_packages_from_autoserv", type=bool)185 # Copy autotest recursively186 if supports_autoserv_packaging and use_autoserv:187 self._install_using_send_file(host, autodir)188 else:...

Full Screen

Full Screen Github


Full Screen

...83#84# # Fetch the autotest client from the nearest repository85# if use_packaging:86# try:...

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?