Best Python code snippet using slash
result.py
Source:result.py
...73 """74 if exc_info is None:75 exc_info = sys.exc_info()76 _, exc_value, _ = exc_info # pylint: disable=unpacking-non-sequence77 if _ADDED_TO_RESULT.is_exception_marked(exc_value):78 return79 _ADDED_TO_RESULT.mark_exception(exc_value)80 if isinstance(exc_value, exceptions.FAILURE_EXCEPTION_TYPES):81 self.add_failure()82 elif isinstance(exc_value, context.session.get_skip_exception_types()):83 self.add_skip(getattr(exc_value, 'reason', str(exc_value)))84 elif isinstance(exc_value, exceptions.INTERRUPTION_EXCEPTIONS):85 err = Error.capture_exception(exc_info=exc_info)86 hooks.interruption_added(result=self, exception=err) # pylint: disable=no-member87 session_result = context.session.results.global_result88 interrupted_test = self.is_interrupted()89 interrupted_session = session_result.is_interrupted()90 if not self.is_global_result():91 self.mark_interrupted()...
test_exception_marks.py
Source:test_exception_marks.py
2from slash.utils.exception_mark import ExceptionMarker, mark_exception, get_exception_mark3def test_marker(exception_class):4 exc = exception_class()5 marker = ExceptionMarker('mark')6 assert not marker.is_exception_marked(exc)7 marker.mark_exception(exc)8 assert marker.is_exception_marked(exc)9def test_marker_mark_returns_exception(exception_class):10 exc = exception_class()11 assert ExceptionMarker('mark').mark_exception(exc) is exc12 assert ExceptionMarker('mark').is_exception_marked(exc)13def test_marker_class(exception_class):14 mark_exception(exception_class, 'a', 'b')15 # Builtin types cannot be marked (on the class) either by setattr or by setting its __dict__:16 # >>> setattr(AttributeError, 'a', 'b')17 # TypeError: can't set attributes of built-in/extension type 'AttributeError'18 # >>> AttributeError.__dict__['a'] = 'b'19 # TypeError: 'mappingproxy' object does not support item assignment20 is_builtin_type = exception_class is AttributeError21 expected = None if is_builtin_type else 'b'22 assert get_exception_mark(exception_class, 'a') == expected23 e = exception_class()24 mark_exception(e, 'c', 'd')25 assert get_exception_mark(e, 'a') == expected26 assert get_exception_mark(e, 'c') == 'd'...
exception_mark.py
Source:exception_mark.py
...28 self.name = name29 def mark_exception(self, e):30 mark_exception(e, self.name, True)31 return e32 def is_exception_marked(self, e):...
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!!