Best Python code snippet using lemoncheesecake
runner.py
Source:runner.py  
...347            # before actual setup348            context.session.start_test_session_setup()349            context.session.set_step("Setup test session")350            # actual setup351            self.teardown_funcs = context.run_setup_funcs(setup_teardown_funcs, ReportLocation.in_test_session_setup())352            # after actual setup353            context.session.end_test_session_setup()354            if not context.session.is_successful(ReportLocation.in_test_session_setup()):355                raise TaskFailure("test session setup failed")356        else:357            self.teardown_funcs = [teardown for _, teardown in setup_teardown_funcs if teardown]358def build_test_session_setup_task(scheduled_fixtures):359    return TestSessionSetupTask(scheduled_fixtures) if not scheduled_fixtures.is_empty() else None360class TestSessionTeardownTask(BaseTask):361    def __init__(self, test_session_setup_task, dependencies):362        BaseTask.__init__(self)363        self.test_session_setup_task = test_session_setup_task364        self._dependencies = dependencies365    def get_on_completion_dependencies(self):366        return self._dependencies367    def run(self, context):368        if any(self.test_session_setup_task.teardown_funcs):...replay.py
Source:replay.py  
...78    # type: (Report, EventManager) -> None79    eventmgr.fire(events.TestSessionStartEvent(report, report.start_time))80    if report.test_session_setup:81        eventmgr.fire(events.TestSessionSetupStartEvent(report.test_session_setup.start_time))82        _replay_steps_events(ReportLocation.in_test_session_setup(), report.test_session_setup.get_steps(), eventmgr)83        if report.test_session_setup.end_time:84            eventmgr.fire(events.TestSessionSetupEndEvent(report.test_session_setup.end_time))85    for suite in report.get_suites():86        _replay_suite_events(suite, eventmgr)87    if report.test_session_teardown:88        eventmgr.fire(events.TestSessionTeardownStartEvent(report.test_session_teardown.start_time))89        _replay_steps_events(ReportLocation.in_test_session_teardown(), report.test_session_teardown.get_steps(), eventmgr)90        if report.test_session_teardown.end_time:91            eventmgr.fire(events.TestSessionTeardownEndEvent(report.test_session_teardown.end_time))92    if report.end_time:...savingstrategy.py
Source:savingstrategy.py  
...11        return ReportLocation.in_suite_setup(event.suite)12    if isinstance(event, SuiteTeardownEndEvent):13        return ReportLocation.in_suite_teardown(event.suite)14    if isinstance(event, TestSessionSetupEndEvent):15        return ReportLocation.in_test_session_setup()16    if isinstance(event, TestSessionTeardownEndEvent):17        return ReportLocation.in_test_session_teardown()18    return None19def save_at_each_suite_strategy(event, _):20    return isinstance(event, SuiteEndEvent)21def save_at_each_test_strategy(event, _):22    return _is_end_of_result_event(event) is not None23def save_at_each_failed_test_strategy(event, report):24    location = _is_end_of_result_event(event)25    if location:26        result = report.get(location)27        return result and result.status == "failed"28    else:29        return False...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!!
