Best Python code snippet using slash
log.py
Source:log.py
...111 assert result112 if result.is_error() or result.is_failure():113 self._try_create_symlink(result.get_log_path(), config.root.log.last_failed_symlink)114 @contextmanager115 def get_session_logging_context(self):116 assert self.session_log_handler is None117 with self._get_file_logging_context(118 config.root.log.session_subpath, config.root.log.last_session_symlink) as (handler, path):119 self.session_log_handler = handler120 self.session_log_path = path121 self.session.results.global_result.set_log_path(path)122 if config.root.log.last_session_dir_symlink is not None and self.session_log_path is not None:123 self._try_create_symlink(os.path.dirname(self.session_log_path), config.root.log.last_session_dir_symlink)124 yield path125 @contextmanager126 def _get_file_logging_context(self, filename_template, symlink):127 try:128 with ExitStack() as stack:129 handler, path = self._get_file_log_handler(filename_template, symlink)...
session.py
Source:session.py
...68 assert ctx.context.result is None69 ctx.context.session = self70 ctx.context.result = self.results.global_result71 self.results.global_result.mark_started()72 self._logging_context = self.logging.get_session_logging_context()73 self._logging_context.__enter__() # https://github.com/PyCQA/pylint/issues/2056: pylint: disable=no-member74 self._warning_capture_context = self.warnings.capture_context()75 self._warning_capture_context.__enter__() # https://github.com/PyCQA/pylint/issues/2056: pylint: disable=no-member76 self._active = True77 def deactivate(self):78 assert self._active, 'Session not active'79 self._active = False80 self.results.global_result.mark_finished()81 exc_info = sys.exc_info()82 self._warning_capture_context.__exit__(*exc_info) # pylint: disable=no-member83 self._warning_capture_context = None84 self._logging_context.__exit__(*exc_info) # pylint: disable=no-member85 self._logging_context = None86 self.results.global_result.mark_finished()...
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!!