How to use _push_pickle method in autotest

Best Python code snippet using autotest_python

test.py

Source:test.py Github

copy

Full Screen

...106 fd, path = tempfile.mkstemp(dir=self.job.tmpdir)107 os.close(fd)108 host.get_file(os.path.join(outputdir, "sysinfo.pickle"), path)109 self.pickle = path110 def _push_pickle(self, host, outputdir):111 """Pushes the server saved sysinfo pickle file to the client.112 """113 if self.pickle:114 host.send_file(self.pickle,115 os.path.join(outputdir, "sysinfo.pickle"))116 os.remove(self.pickle)117 self.pickle = None118 def _pull_sysinfo_keyval(self, host, outputdir, mytest):119 """Pulls sysinfo and keyval data from the client.120 """121 # pull the sysinfo data back on to the server122 host.get_file(os.path.join(outputdir, "sysinfo"), mytest.outputdir)123 # pull the keyval data back into the local one124 fd, path = tempfile.mkstemp(dir=self.job.tmpdir)125 os.close(fd)126 host.get_file(os.path.join(outputdir, "keyval"), path)127 keyval = utils.read_keyval(path)128 os.remove(path)129 mytest.write_test_keyval(keyval)130 @log.log_and_ignore_errors("pre-test server sysinfo error:")131 @install_autotest_and_run132 def before_hook(self, mytest, host, at, outputdir):133 if not self.disable_hooks:134 # run the pre-test sysinfo script135 at.run(_sysinfo_before_test_script % outputdir,136 results_dir=self.job.resultdir)137 self._pull_pickle(host, outputdir)138 @log.log_and_ignore_errors("pre-test iteration server sysinfo error:")139 @install_autotest_and_run140 def before_iteration_hook(self, mytest, host, at, outputdir):141 if not self.disable_hooks:142 # this function is called after before_hook() se we have sysinfo state143 # to push to the server144 self._push_pickle(host, outputdir)145 # run the pre-test iteration sysinfo script146 at.run(_sysinfo_iteration_script %147 (outputdir, 'log_before_each_iteration', mytest.iteration,148 'before'),149 results_dir=self.job.resultdir)150 # get the new sysinfo state from the client151 self._pull_pickle(host, outputdir)152 @log.log_and_ignore_errors("post-test iteration server sysinfo error:")153 @install_autotest_and_run154 def after_iteration_hook(self, mytest, host, at, outputdir):155 if not self.disable_hooks:156 # push latest sysinfo state to the client157 self._push_pickle(host, outputdir)158 # run the post-test iteration sysinfo script159 at.run(_sysinfo_iteration_script %160 (outputdir, 'log_after_each_iteration', mytest.iteration,161 'after'),162 results_dir=self.job.resultdir)163 # get the new sysinfo state from the client164 self._pull_pickle(host, outputdir)165 @log.log_and_ignore_errors("post-test server sysinfo error:")166 @install_autotest_and_run167 def after_hook(self, mytest, host, at, outputdir):168 if not self.disable_hooks:169 self._push_pickle(host, outputdir)170 # run the post-test sysinfo script171 at.run(_sysinfo_after_test_script % outputdir,172 results_dir=self.job.resultdir)173 self._pull_sysinfo_keyval(host, outputdir, mytest)174 def cleanup(self, host_close=True):175 if self.host and self.autotest:176 try:177 try:178 self.autotest.uninstall()179 finally:180 if host_close:181 self.host.close()182 else:183 self.host.erase_dir_contents(self.outputdir)...

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:

YouTube

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?

Helpful

NotHelpful