How to use _validate_bug_and_bug_type method in tempest

Best Python code snippet using tempest_python

decorators.py

Source:decorators.py Github

copy

Full Screen

...21_SUPPORTED_BUG_TYPES = {22 'launchpad': 'https://launchpad.net/bugs/%s',23 'storyboard': 'https://storyboard.openstack.org/#!/story/%s',24}25def _validate_bug_and_bug_type(bug, bug_type):26 """Validates ``bug`` and ``bug_type`` values.27 :param bug: bug number causing the test to skip (launchpad or storyboard)28 :param bug_type: 'launchpad' or 'storyboard', default 'launchpad'29 :raises: InvalidParam if ``bug`` is not a digit or ``bug_type`` is not30 a valid value31 """32 if not bug.isdigit():33 invalid_param = '%s must be a valid %s number' % (bug, bug_type)34 raise lib_exc.InvalidParam(invalid_param=invalid_param)35 if bug_type not in _SUPPORTED_BUG_TYPES:36 invalid_param = 'bug_type "%s" must be one of: %s' % (37 bug_type, ', '.join(_SUPPORTED_BUG_TYPES.keys()))38 raise lib_exc.InvalidParam(invalid_param=invalid_param)39def _get_bug_url(bug, bug_type='launchpad'):40 """Get the bug URL based on the ``bug_type`` and ``bug``41 :param bug: The launchpad/storyboard bug number causing the test42 :param bug_type: 'launchpad' or 'storyboard', default 'launchpad'43 :returns: Bug URL corresponding to ``bug_type`` value44 """45 _validate_bug_and_bug_type(bug, bug_type)46 return _SUPPORTED_BUG_TYPES[bug_type] % bug47def skip_because(*args, **kwargs):48 """A decorator useful to skip tests hitting known bugs49 ``bug`` must be a number and ``condition`` must be true for the test to50 skip.51 :param bug: bug number causing the test to skip (launchpad or storyboard)52 :param bug_type: 'launchpad' or 'storyboard', default 'launchpad'53 :param condition: optional condition to be True for the skip to have place54 :raises: testtools.TestCase.skipException if ``condition`` is True and55 ``bug`` is included56 """57 def decorator(f):58 @functools.wraps(f)59 def wrapper(*func_args, **func_kwargs):...

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