How to use is_task_to_be_skipped method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

runner.py

Source:runner.py Github

copy

Full Screen

...61 self.handle_exception(e)62 def enable_task_abort(self):63 super(RunContext, self).enable_task_abort()64 self.session.aborted = True65 def is_task_to_be_skipped(self, task):66 # check for error in base implementation67 skip_reason = super(RunContext, self).is_task_to_be_skipped(task)68 if skip_reason:69 return skip_reason70 # check for error in event handling71 exception, _ = self.session.event_manager.get_pending_failure()72 if exception is not None:73 return str(exception)74 # check for test session abort75 if self._aborted_session:76 return "tests have been aborted"77 # check for suite abort78 if isinstance(task, TestTask):79 if task.test.parent_suite in self._aborted_suites:80 return "the tests of this test suite have been aborted"81 # check for --stop-on-failure...

Full Screen

Full Screen

task.py

Source:task.py Github

copy

Full Screen

...34 def __init__(self):35 self._tasks_aborted = False36 def enable_task_abort(self):37 self._tasks_aborted = True38 def is_task_to_be_skipped(self, task):39 if self._tasks_aborted:40 return "tests have been manually stopped"41 else:42 return None43def pop_runnable_tasks(remaining_tasks, completed_tasks, nb_tasks):44 runnable_tasks = list(45 itertools.islice(46 filter(lambda t: set(t.get_all_dependencies()).issubset(completed_tasks), remaining_tasks),47 0, nb_tasks48 )49 )50 for task in runnable_tasks:51 remaining_tasks.remove(task)52 _debug("pop runnable task %s" % task)53 yield task54def run_task(task, context, completed_task_queue):55 _debug("run task %s" % task)56 try:57 task.run(context)58 except TaskFailure as excp:59 task.result = TaskResultFailure(str(excp))60 except Exception:61 task.result = TaskResultException(serialize_current_exception())62 else:63 task.result = TaskResultSuccess()64 completed_task_queue.put(task)65def handle_task(task, context, completed_task_queue):66 _debug("handle task %s" % task)67 # skip task on dependency failure if any68 for dep_task in task.get_on_success_dependencies():69 if not isinstance(dep_task.result, TaskResultSuccess):70 if isinstance(dep_task.result, (TaskResultFailure, TaskResultSkipped)):71 reason = dep_task.result.reason72 else:73 reason = None74 skip_task(task, context, completed_task_queue, reason)75 return76 # skip task on external trigger if any77 skip_reason = context.is_task_to_be_skipped(task)78 if skip_reason:79 skip_task(task, context, completed_task_queue, reason=skip_reason)80 return81 # run task when all conditions are met82 run_task(task, context, completed_task_queue)83def schedule_tasks_to_be_run(tasks, context, pool, completed_tasks_queue):84 for task in tasks:85 pool.apply_async(handle_task, args=(task, context, completed_tasks_queue))86def skip_task(task, context, completed_task_queue, reason=""):87 _debug("skip task %s" % task)88 try:89 task.skip(context, reason)90 except Exception:91 task.result = TaskResultException(serialize_current_exception())...

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