How to use should_stop_on_error method in Slash

Best Python code snippet using slash

runner.py

Source:runner.py Github

copy

Full Screen

...17 """18 Runs tests from an iterable using the current session19 """20 # pylint: disable=maybe-no-member21 def should_stop_on_error():22 if stop_on_error is None:23 return config.root.run.stop_on_error24 return stop_on_error25 if context.session is None or not context.session.started:26 raise NoActiveSession("A session is not currently started")27 test_iterator = PeekableIterator(iterable)28 last_filename = None29 complete = False30 try:31 for test in test_iterator:32 if config.root.run.dump_variation:33 _dump_variation(test)34 _set_test_metadata(test)35 test_filename = test.__slash__.file_path36 if last_filename != test_filename:37 context.session.reporter.report_file_start(test_filename)38 last_filename = test_filename39 context.session.reporter.report_test_start(test)40 _logger.notice(41 "#{}: {}",42 test.__slash__.test_index1,43 test.__slash__.get_address(44 raw_params=config.root.log.show_raw_param_values45 ),46 extra={'highlight': True, 'filter_bypass': True})47 _run_single_test(test, test_iterator)48 result = context.session.results[test]49 context.session.reporter.report_test_end(test, result)50 if not test_iterator.has_next() or ensure_test_metadata(test_iterator.peek()).file_path != last_filename:51 context.session.reporter.report_file_end(last_filename)52 if result.has_fatal_exception():53 _logger.debug("Stopping on fatal exception")54 break55 if should_stop_on_error() and not context.session.results.is_success(allow_skips=True):56 _logger.debug("Stopping (run.stop_on_error==True)")57 break58 else:59 complete = True60 finally:61 if config.root.parallel.worker_id is None:62 context.session.initiate_cleanup()63 if config.root.parallel.worker_id is None:64 _mark_unrun_tests(test_iterator)65 if complete:66 context.session.mark_complete()67 elif last_filename is not None:68 context.session.reporter.report_file_end(last_filename)69 _logger.trace('Session finished. is_success={0} has_skips={1}',...

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