Best Python code snippet using autotest_python
base_job.py
Source:base_job.py
...661 self._serverdir = None662 # initialize all the other directories relative to the base ones663 self._initialize_dir_properties()664 self._resultdir = self._job_directory(665 self._find_resultdir(*args, **dargs), True)666 self._execution_contexts = []667 # initialize all the job state668 self._state = self._job_state()669 @classmethod670 def _find_base_directories(cls):671 raise NotImplementedError()672 def _initialize_dir_properties(self):673 """674 Initializes all the secondary self.*dir properties. Requires autodir,675 clientdir and serverdir to already be initialized.676 """677 # create some stubs for use as shortcuts678 def readonly_dir(*args):679 return self._job_directory(os.path.join(*args))680 def readwrite_dir(*args):681 return self._job_directory(os.path.join(*args), True)682 # various client-specific directories683 self._bindir = readonly_dir(self.clientdir, 'bin')684 self._profdir = readonly_dir(self.clientdir, 'profilers')685 self._pkgdir = readwrite_dir(self.clientdir, 'packages')686 self._toolsdir = readonly_dir(self.clientdir, 'tools')687 # directories which are in serverdir on a server, clientdir on a client688 # tmp tests, and site_tests need to be read_write for client, but only689 # read for server.690 if self.serverdir:691 root = self.serverdir692 r_or_rw_dir = readonly_dir693 else:694 root = self.clientdir695 r_or_rw_dir = readwrite_dir696 self._testdir = r_or_rw_dir(root, 'tests')697 self._site_testdir = r_or_rw_dir(root, 'site_tests')698 # various server-specific directories699 if self.serverdir:700 self._tmpdir = readwrite_dir(tempfile.gettempdir())701 else:702 self._tmpdir = readwrite_dir(root, 'tmp')703 def _find_resultdir(self, *args, **dargs):704 raise NotImplementedError()705 def push_execution_context(self, resultdir):706 """707 Save off the current context of the job and change to the given one.708 In practice method just changes the resultdir, but it may become more709 extensive in the future. The expected use case is for when a child710 job needs to be executed in some sort of nested context (for example711 the way parallel_simple does). The original context can be restored712 with a pop_execution_context call.713 @param resultdir: The new resultdir, relative to the current one.714 """715 new_dir = self._job_directory(716 os.path.join(self.resultdir, resultdir), True)717 self._execution_contexts.append(self._resultdir)...
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!!