How to use _is_node_disabled method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

core.py

Source:core.py Github

copy

Full Screen

...6from lemoncheesecake.helpers.orderedset import OrderedSet7from lemoncheesecake.helpers.introspection import get_callable_args, get_object_attributes8from lemoncheesecake.testtree import BaseTest, BaseSuite9SUITE_HOOKS = "setup_test", "teardown_test", "setup_suite", "teardown_suite"10def _is_node_disabled(node):11 while node is not None:12 if node.disabled:13 return node.disabled14 node = node.parent_suite15 return False16class Test(BaseTest):17 """18 Internal representation of a test.19 """20 def __init__(self, name, description, callback):21 BaseTest.__init__(self, name, description)22 self.callback = callback23 self.disabled = False24 self.hidden = False25 self.rank = 026 self.dependencies = []27 self.parameters = {}28 def is_disabled(self):29 return _is_node_disabled(self)30 def is_enabled(self):31 return not self.is_disabled()32 def get_arguments(self):33 return get_callable_args(self.callback)34 def get_fixtures(self):35 return list(filter(lambda arg: arg not in self.parameters, self.get_arguments()))36class InjectedFixture:37 def __init__(self, fixture_name):38 self.fixture_name = fixture_name39class Suite(BaseSuite):40 """41 Internal representation of a suite.42 """43 def __init__(self, obj, name, description):44 BaseSuite.__init__(self, name, description)45 self.obj = obj46 self.rank = 047 self.disabled = False48 self.hidden = False49 self._hooks = {}50 self._injected_fixtures = self._load_injected_fixtures(obj) if obj else {}51 # to optimize unique constraint checks on test/suite name/description, keep those52 # strings in sets:53 self._test_names = set()54 self._test_descriptions = set()55 self._sub_suite_names = set()56 self._sub_suite_descriptions = set()57 @staticmethod58 def _assert_hook_name(hook_name):59 assert hook_name in SUITE_HOOKS, "Invalid hook name '%s'" % hook_name60 @staticmethod61 def _load_injected_fixtures(obj):62 fixtures = {}63 for attr_name, attr in get_object_attributes(obj):64 if isinstance(attr, InjectedFixture):65 fixtures[attr.fixture_name or attr_name] = attr_name66 return fixtures67 def is_disabled(self):68 return _is_node_disabled(self)69 def has_enabled_tests(self):70 return any(test.is_enabled() for test in self.get_tests())71 def add_hook(self, hook_name, func):72 self._assert_hook_name(hook_name)73 self._hooks[hook_name] = func74 def has_hook(self, hook_name):75 self._assert_hook_name(hook_name)76 return hook_name in self._hooks77 def get_hook(self, hook_name):78 self._assert_hook_name(hook_name)79 return self._hooks.get(hook_name)80 def get_hook_params(self, hook_name):81 hook = self.get_hook(hook_name)82 assert hook...

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