Best Python code snippet using autotest_python
data_logger.py
Source:data_logger.py
...19 _log_file_set = False20 def __init__(self):21 pass22 def start_log(self, work_dir, log_file):23 if self.set_working_directory(work_dir):24 self.set_log_file(log_file)25 return Data_Logger._log_file_set26 def set_working_directory(self,work_dir):27 if work_dir != '':28 # try and create a working directory path29 try:30 if work_dir[-1:] == Data_Logger._slash:31 Data_Logger._working_directory = work_dir + Data_Logger._log_start_str32 else:33 Data_Logger._working_directory = work_dir + Data_Logger._slash + \34 Data_Logger._working_directory35 except:36 self.message('Error setting working directory = ', work_dir)37 # try and create a new working directory38 else:39 try:40 os.makedirs(Data_Logger._working_directory)...
format.py
Source:format.py
...39 timeout,40 exec_env)41 self.device_dir = device_dir42 self.executor = TimeoutExecutor(timeout, AdbExecutor())43 def _working_directory(self, file_name):44 return os.path.join(self.device_dir, file_name)45 def _wd_path(self, test_name, file_name):46 return os.path.join(self._working_directory(test_name), file_name)47 def _clean(self, exec_path):48 exec_file = os.path.basename(exec_path)49 cmd = ['adb', 'shell', 'rm', '-rf', self._working_directory(exec_file)]50 lit.util.executeCommand(cmd)51 try:52 os.remove(exec_path)53 except OSError:54 pass55 def _run(self, exec_path, _, in_dir=None):...
_LocalVariable_example.py
Source:_LocalVariable_example.py
1# this an example for _LocalVariable.py2# directories 3_WORKING_DIRECTORY = <dir>4_DATA_DIRECTORY = _WORKING_DIRECTORY + r"\Data"5_OBJECT_DIRECTORY = _WORKING_DIRECTORY + r"\Object"6_TRAINED_MODEL_OUTPUT_DIRECTORY = _WORKING_DIRECTORY + r"\TrainedModelOutput"7_DATA_INPUT_DIRECTORY = _DATA_DIRECTORY + r"\Input"8_DATA_OUTPUT_DIRECTORY = _DATA_DIRECTORY + r"\Output"9# browser driver path10_FIREFOX_DRIVER_PATH = <dir>11# twitter api12_TWITTER_ACCESS_TOKEN = <string>13_TWITTER_ACCESS_TOKEN_SECRET = <string>14_TWITTER_CONSUMER_KEY = <string>...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!