How to use load_suites method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

test_plugin.py

Source:test_plugin.py Github

copy

Full Screen

...10 global load_suites, QualitySuite11 from vigilance.suite import QualitySuite12 from vigilance.plugin import load_suites13 def test_load_suites_with_malformed_plugin_should_log_warning(self):14 load_suites(['nocolonhere'], disableDefaults=True)15 self.log.warning.assert_called_once_with('Skipping malformed plugin specifier "%s"', 'nocolonhere')16 @mock.patch.object(importlib, 'import_module')17 def test_load_suites_with_missing_plugin_module_should_log_warning(self, mockImport):18 mockImport.side_effect = ImportError('that is really not there')19 load_suites(['this.one:isright'], disableDefaults=True)20 self.log.warning.assert_called_once_with('Skipping missing plugin module "%s"', 'this.one')21 @mock.patch.object(importlib, 'import_module')22 def test_load_suites_with_missing_plugin_implementation_should_log_warning(self, mockImport):23 mockImport.return_value.goodguy = mock.PropertyMock(side_effect=AttributeError('this is just a mirage'))24 load_suites(['so.close.to:goodguy'], disableDefaults=True)25 self.log.warning.assert_called_once_with('Skipping missing plugin implementation "%s" within plugin "%s"', 'goodguy', 'so.close.to')26 def test_load_suites_should_load_default_suites(self):27 load_suites([])28 self.assertEqual(2, len(QualitySuite.available_suites()))29@mock.patch('vigilance.plugin.open', create=True)30@mock.patch.object(os, 'path')31class GetConfiguredPluginsTest(VigilanceTestCase):32 def setUp(self):33 super(GetConfiguredPluginsTest, self).setUp()34 global get_configured_plugins35 from vigilance.plugin import get_configured_plugins36 def test_get_configured_plugins_with_malformed_dotfile_should_log_warning(self, mockPath, mockOpen):37 mockPath.isfile.side_effect = lambda p: p == '.vigilance'38 mockOpen.return_value.__enter__.return_value = StringIO('{uh oh not ini}')39 self.assertEqual([], get_configured_plugins())40 self.log.warning.assert_called_once_with('Skipping malformed configuration file "%s"', '.vigilance')41 def test_get_configured_plugins_with_malformed_setupcfg_should_log_warning(self, mockPath, mockOpen):...

Full Screen

Full Screen

test_rules.py

Source:test_rules.py Github

copy

Full Screen

...3from matrix import rules4def loader(name):5 return resource_filename(__name__, name)6def test_parser():7 s = rules.load_suites([loader("rules.1.yaml")])8 # Suite should have one test with 3 rules9 assert len(s) == 310 assert len(s[0].rules) == 411 assert s[0].rules[0].task.command == 'matrix.tasks.deploy'12 assert s[0].rules[-1].task.command == 'matrix.tasks.health'13 # test merge with overrides and adds14 s = rules.load_suites([loader("rules.1.yaml"), loader("rules.2.yaml")])15 assert len(s) == 416 assert len(s[0].rules) == 117 assert s[0].rules[0].task.command == 'tests.chaos.chaos'18 assert s[-1].rules[0].task.command == 'tests.health'19def test_rule_conditions():20 s = rules.load_suites([loader("rules.1.yaml")])21 context = model.Context(22 loop=None, bus=None, config=None,23 juju_controller=None,24 suite=s)25 context.states.update({"deploy": "complete"})26 t = s[0].rules27 assert t[0].has("until") is False28 assert t[1].has("until") is True29 assert t[2].has("until") is False30 assert t[0].has("while") is False31 assert t[1].has("while") is False32 assert t[2].has("while") is True33 assert t[0].match(context) is True34 assert t[1].match(context) is False...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...18 for item in collection1:19 if item not in collection2:20 raise AssertionError(u'%r !contains %r' % (collection1, collection2))21 22def load_suites(module_names):23 suites = []24 if isinstance(module_names, str):25 module_names = module_names.strip().split('\n')26 for modname in module_names:27 modname = modname.strip()28 if modname:29 __import__(modname)30 mod = sys.modules[modname]31 try:32 suites.append(getattr(mod, 'suite')())33 except AttributeError, e:34 if "has no attribute 'suite'" in e.args[0]:35 e.args = ('module %s has no suite' % mod,)36 raise e37 return suites38def suite():39 suites = load_suites('''40 smisk.test.config41 smisk.test.core.url42 smisk.test.core.xml43 smisk.test.inflection44 smisk.test.mvc.control45 smisk.test.mvc.routing46 smisk.test.serialization47 smisk.test.util.introspect48 smisk.test.util.string_49 ''')50 return unittest.TestSuite(suites)51def test(*va, **kw):52 runner = unittest.TextTestRunner(*va, **kw)53 return runner.run(suite())...

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