How to use _set_common_filter_criteria method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

filter.py

Source:filter.py Github

copy

Full Screen

...257def add_result_filter_cli_args(cli_parser, only_executed_tests=False):258 return _add_filter_cli_args(cli_parser, no_positional_argument=True, only_executed_tests=only_executed_tests)259def add_step_filter_cli_args(cli_parser):260 return _add_filter_cli_args(cli_parser, no_positional_argument=True, only_executed_tests=True)261def _set_common_filter_criteria(fltr, cli_args, only_executed_tests=False):262 if not only_executed_tests and (cli_args.disabled and cli_args.enabled):263 raise UserError("--disabled and --enabled arguments are mutually exclusive")264 fltr.paths = cli_args.path265 fltr.descriptions = cli_args.desc266 fltr.tags = cli_args.tag267 fltr.properties = cli_args.property268 fltr.links = cli_args.link269 if not only_executed_tests:270 fltr.disabled = cli_args.disabled271 fltr.enabled = cli_args.enabled272def _make_test_filter(cli_args):273 if cli_args.passed or cli_args.failed or cli_args.skipped:274 raise UserError("--passed, --failed and --skipped arguments can only be used on the report-based filter")275 test_filter = TestFilter()276 _set_common_filter_criteria(test_filter, cli_args)277 return test_filter278def _make_grep_criterion(grep):279 return re.compile(grep, re.IGNORECASE | re.MULTILINE)280def make_result_filter(cli_args, only_executed_tests=False):281 result_filter = ResultFilter()282 _set_common_filter_criteria(result_filter, cli_args, only_executed_tests=only_executed_tests)283 if only_executed_tests:284 if cli_args.passed:285 result_filter.statuses.add("passed")286 if cli_args.failed:287 result_filter.statuses.add("failed")288 # when neither --passed not --failed was passed, enforce statuses passed and failed289 # to select tests that have been executed290 if not result_filter.statuses:291 result_filter.statuses.update(("passed", "failed"))292 else:293 if cli_args.passed:294 result_filter.statuses.add("passed")295 if cli_args.failed:296 result_filter.statuses.add("failed")297 if cli_args.skipped:298 result_filter.statuses.add("skipped")299 if cli_args.non_passed:300 result_filter.statuses.update(("failed", "skipped"))301 if cli_args.grep:302 result_filter.grep = _make_grep_criterion(cli_args.grep)303 return result_filter304def _make_from_report_filter(cli_args, only_executed_tests=False):305 report = load_report(cli_args.from_report or DEFAULT_REPORT_DIR_NAME)306 test_filter = make_result_filter(cli_args, only_executed_tests=only_executed_tests)307 return FromTestsFilter(filter(test_filter, report.all_tests()))308def make_test_filter(cli_args):309 if any((cli_args.from_report, cli_args.passed, cli_args.failed, cli_args.skipped, cli_args.non_passed, cli_args.grep)):310 return _make_from_report_filter(cli_args)311 else:312 return _make_test_filter(cli_args)313def make_step_filter(cli_args):314 if cli_args.passed and cli_args.failed:315 raise UserError("--passed and --failed arguments are mutually exclusive")316 step_filter = StepFilter()317 _set_common_filter_criteria(step_filter, cli_args, only_executed_tests=True)318 step_filter.passed = cli_args.passed319 step_filter.failed = cli_args.failed320 if cli_args.grep:321 step_filter.grep = _make_grep_criterion(cli_args.grep)...

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