How to use _is_test_disabled method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

runner.py

Source:runner.py Github

copy

Full Screen

...89 self.suite_scheduled_fixtures = suite_scheduled_fixtures90 self.dependencies = [dependency] if dependency else []91 def get_on_success_dependencies(self):92 return self.dependencies93 def _is_test_disabled(self, context):94 return self.test.is_disabled() and not context.force_disabled95 def _handle_disabled_test(self, context):96 disabled = self.test.is_disabled()97 disabled_reason = disabled if isinstance(disabled, six.string_types) else None98 context.session.disable_test(self.test, disabled_reason)99 def skip(self, context, reason=None):100 if self._is_test_disabled(context):101 self._handle_disabled_test(context)102 else:103 context.session.skip_test(self.test, "Test skipped because %s" % reason if reason else None)104 @staticmethod105 def _prepare_test_args(test, scheduled_fixtures):106 args = {}107 for arg_name in test.get_arguments():108 if arg_name in test.parameters:109 args[arg_name] = test.parameters[arg_name]110 else:111 args[arg_name] = scheduled_fixtures.get_fixture_result(arg_name)112 return args113 def run(self, context):114 ###115 # Checker whether the test must be executed or not116 ###117 if self._is_test_disabled(context):118 self._handle_disabled_test(context)119 return120 ###121 # Begin test122 ###123 context.session.start_test(self.test)124 ###125 # Setup test (setup and fixtures)126 ###127 suite = self.test.parent_suite128 if suite.has_hook("setup_test"):129 def setup_test_wrapper():130 suite.get_hook("setup_test")(self.test)131 else:...

Full Screen

Full Screen

conftest.py

Source:conftest.py Github

copy

Full Screen

...66 except ClientError as e:67 print("ClientError when performing S3/STS operation: {}".format(e))68 json_content = {}69 return json_content70def _is_test_disabled(test_name, build_name, version):71 """72 Expected format of remote_override_flags:73 {74 "CB Project Name for Test Type A": {75 "CodeBuild Resolved Source Version": ["test_type_A_test_function_1", "test_type_A_test_function_2"]76 },77 "CB Project Name for Test Type B": {78 "CodeBuild Resolved Source Version": ["test_type_B_test_function_1", "test_type_B_test_function_2"]79 }80 }81 :param test_name: str Test Function node name (includes parametrized values in string)82 :param build_name: str Build Project name of current execution83 :param version: str Source Version of current execution84 :return: bool True if test is disabled as per remote override, False otherwise85 """86 remote_override_flags = _get_remote_override_flags()87 remote_override_build = remote_override_flags.get(build_name, {})88 if version in remote_override_build:89 return (90 not remote_override_build[version]91 or any([test_keyword in test_name for test_keyword in remote_override_build[version]])92 )93 return False94@pytest.fixture(autouse=True)95def disable_test(request):96 test_name = request.node.name97 # We do not have a regex pattern to find CB name, which means we must resort to string splitting98 build_arn = os.getenv("CODEBUILD_BUILD_ARN")99 build_name = build_arn.split("/")[-1].split(":")[0] if build_arn else None100 version = os.getenv("CODEBUILD_RESOLVED_SOURCE_VERSION")101 if build_name and version and _is_test_disabled(test_name, build_name, version):...

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