How to use noswallow method in Slash

Best Python code snippet using slash

test_exception_handling.py

Source:test_exception_handling.py Github

copy

Full Screen

...149def test_no_swallow():150 raised = CustomException()151 with pytest.raises(CustomException) as caught:152 with exception_handling.get_exception_swallowing_context():153 raise exception_handling.noswallow(raised)154 assert raised is caught.value155def test_disable_exception_swallowing_function():156 raised = CustomException()157 with pytest.raises(CustomException) as caught:158 with exception_handling.get_exception_swallowing_context():159 exception_handling.disable_exception_swallowing(raised)160 raise raised161 assert caught.value is raised162def test_disable_exception_swallowing_decorator():163 raised = CustomException()164 @exception_handling.disable_exception_swallowing165 def func():166 raise raised167 with pytest.raises(CustomException) as caught:...

Full Screen

Full Screen

exception_handling.py

Source:exception_handling.py Github

copy

Full Screen

...143 raise144 if report_to_sentry:145 capture_sentry_exception()146 _logger.debug("Ignoring exception", exc_info=sys.exc_info())147def noswallow(exception):148 """149 Marks an exception to prevent swallowing by :func:`slash.exception_handling.get_exception_swallowing_context`,150 and returns it151 """152 mark_exception(exception, "swallow", False)153 return exception154def mark_exception_fatal(exception):155 """156 Causes this exception to halt the execution of the entire run.157 This is useful when detecting errors that need careful examination, thus preventing further tests from158 altering the test subject's state159 """160 mark_exception(exception, "fatal", True)161 return exception162def mark_exception_frame_correction(exception, correction=+1):163 current_correction = get_exception_frame_correction(exception)164 return mark_exception(exception, 'frame_correction', current_correction + correction)165def get_exception_frame_correction(exception):166 return get_exception_mark(exception, 'frame_correction', 0)167def is_exception_fatal(exception):168 return bool(get_exception_mark(exception, "fatal", False))169def inhibit_unhandled_exception_traceback(exception):170 """171 Causes this exception to inhibit console tracback172 """173 mark_exception(exception, "inhibit_console_tb", True)174 return exception175def should_inhibit_unhandled_exception_traceback(exception):176 return bool(get_exception_mark(exception, "inhibit_console_tb", False))177def disable_exception_swallowing(func_or_exception):178 """179 Marks an exception to prevent swallowing. Can also be used as a decorator around a function to mark all escaped180 exceptions181 """182 if isinstance(func_or_exception, BaseException):183 return noswallow(func_or_exception)184 @functools.wraps(func_or_exception)185 def func(*args, **kwargs):186 try:187 return func_or_exception(*args, **kwargs)188 except BaseException as e:189 disable_exception_swallowing(e)190 raise191 return func192def capture_sentry_exception():193 client = get_sentry_client()194 if client is not None:195 client.captureException()196def get_sentry_client():197 if raven is not None and config.root.sentry.dsn:...

Full Screen

Full Screen

hooks.py

Source:hooks.py Github

copy

Full Screen

1import asyncio2import psutil3from .matches import d4from libqtile import hook5@hook.subscribe.client_new6def assign_app_group(client):7 try:8 wm_class = client.window.get_wm_class()[0]9 except Exception:10 wm_class = None11 for i in range(len(d)):12 if wm_class in list(d.values())[i]:13 group = list(d.keys())[i]14 client.togroup(group, toggle=False)15 client.group.cmd_toscreen(toggle=False)16@hook.subscribe.client_new17async def move_client(client):18 await asyncio.sleep(0.1)19 if client.window.get_wm_class()[0] == "spotify":20 client.togroup("media")21# noswallow = [22# "qutebrowser",23# "Navigator",24# "vlc",25# ]26# @hook.subscribe.client_new27# def _swallow(window):28# if window.qtile.group.current_layout is not "max":29# try:30# wm_class = window.window.get_wm_class()[0]31# except Exception:32# wm_class = None33# if wm_class not in noswallow:34# pid = window.window.get_net_wm_pid()35# ppid = psutil.Process(pid).ppid()36# cpids = {37# c.window.get_net_wm_pid(): wid38# for wid, c in window.qtile.windows_map.items()39# }40# for i in range(5):41# if not ppid:42# return43# if ppid in cpids:44# parent = window.qtile.windows_map.get(cpids[ppid])45# parent.minimized = True46# window.parent = parent47# return48# ppid = psutil.Process(ppid).ppid()49# @hook.subscribe.client_killed50# def _unswallow(window):51# if hasattr(window, "parent"):...

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 Slash 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