Best Python code snippet using yandex-tank
execute.py
Source:execute.py  
...29      api.step_data(30          'presubmit',31          api.json.output({'errors': [], 'notifications': [], 'warnings': []}),32      ) +33      api.post_process(post_process.StatusSuccess) +34      api.post_process(post_process.DropExpectation)35  )36  yield (37      api.test('cq_dry_run') +38      api.runtime(is_experimental=False, is_luci=True) +39      api.buildbucket.try_build(project='infra') +40      api.cq(dry_run=True) +41      api.post_process(post_process.StatusSuccess) +42      api.post_process(post_process.StepCommandContains, 'presubmit', ['--dry_run']) +43      api.post_process(post_process.DropExpectation)44  )45  yield (46      api.test('skip_owners') +47      api.runtime(is_experimental=False, is_luci=True) +48      api.buildbucket.try_build(project='infra') +49      api.properties(skip_owners=True) +50      api.post_process(post_process.StatusSuccess) +51      api.post_process(52          post_process.StepCommandContains, 'presubmit', ['--skip_canned', 'CheckOwners']) +53      api.post_process(post_process.DropExpectation)54  )55  yield (56      api.test('timeout') +57      api.runtime(is_experimental=False, is_luci=True) +58      api.buildbucket.try_build(project='infra') +59      api.presubmit(timeout_s=600) +60      api.step_data(61          'presubmit',62          api.json.output({'errors': [], 'notifications': [], 'warnings': []}),63          times_out_after=1200,64      ) +65      api.post_process(post_process.StatusFailure) +66      api.post_process(67          post_process.ResultReason,68         (u'#### There are 0 error(s), 0 warning(s), and 0 notifications(s).'69          ' Here are the errors:'70          '\n\nTimeout occurred during presubmit step.')) +71      api.post_process(post_process.DropExpectation)72  )73  yield (74      api.test('failure') +75      api.runtime(is_experimental=False, is_luci=True) +76      api.buildbucket.try_build(project='infra') +77      api.step_data('presubmit', api.json.output(78          {79            'errors': [80              {81                'message': 'Missing LGTM',82                'long_text': 'Here are some suggested OWNERS: fake@',83                'items': [],84                'fatal': True85              },86              {87                'message': 'Syntax error in fake.py',88                'long_text': 'Expected "," after item in list',89                'items': [],90                'fatal': True91              }92            ],93            'notifications': [94              {95                'message': 'If there is a bug associated please add it.',96                'long_text': '',97                'items': [],98                'fatal': False99              }100            ],101            'warnings': [102              {103                'message': 'Line 100 has more than 80 characters',104                'long_text': '',105                'items': [],106                'fatal': False107              }108            ]109          }, retcode=1)110      ) +111      api.post_process(post_process.StatusFailure) +112      api.post_process(post_process.ResultReason, textwrap.dedent(u'''113          #### There are 2 error(s), 1 warning(s), and 1 notifications(s). Here are the errors:114          **ERROR**115          ```116          Missing LGTM117          Here are some suggested OWNERS: fake@118          ```119          **ERROR**120          ```121          Syntax error in fake.py122          Expected "," after item in list123          ```124          #### To see notifications and warnings, look at the stdout of the presubmit step.125        ''').strip()126      ) +127      api.post_process(post_process.DropExpectation)128  )129  long_message = (u'Here are some suggested OWNERS:' +130    u'\nreallyLongFakeAccountNameEmail@chromium.org' * 10)131  yield (132      api.test('failure-long-message') +133      api.runtime(is_experimental=False, is_luci=True) +134      api.buildbucket.try_build(project='infra') +135      api.step_data('presubmit', api.json.output(136          {137            'errors': [138              {139                'message': 'Missing LGTM',140                'long_text': long_message,141                'items': [],142                'fatal': True143              }144            ],145            'notifications': [],146            'warnings': []147          }, retcode=1)148      ) +149      api.post_process(post_process.StatusFailure) +150      api.post_process(post_process.ResultReason, textwrap.dedent('''151          #### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:152          **ERROR**153          ```154          Missing LGTM155          Here are some suggested OWNERS:156          reallyLongFakeAccountNameEmail@chromium.org157          reallyLongFakeAccountNameEmail@chromium.org158          reallyLongFakeAccountNameEmail@chromium.org159          reallyLongFakeAccountNameEmail@chromium.org160          reallyLongFakeAccountNameEmail@chromium.org161          reallyLongFakeAccountNameEmail@chromium.org162          reallyLongFakeAccountNameEmail@chromium.org163          reallyLongFakeAccountNameEmail@chromium.org164          reallyLongFakeAccountNameEmail@chromium.org165          ```166          **Error size > 450 chars, there are 2 more error(s) (15 total)**167          **The complete output can be found at the bottom of the presubmit stdout.**168        ''').strip()169      ) +170      api.post_process(post_process.DropExpectation)171  )172  yield (173      api.test('infra-failure') +174      api.runtime(is_experimental=False, is_luci=True) +175      api.buildbucket.try_build(project='infra') +176      api.step_data('presubmit', api.json.output(177          {178            'errors': [179              {180                'message': 'Infra Failure',181                'long_text': '',182                'items': [],183                'fatal': True184              }185            ],186            'notifications': [],187            'warnings': []188          }, retcode=2)189      ) +190      api.post_process(post_process.StatusException) +191      api.post_process(post_process.ResultReason, textwrap.dedent(u'''192        #### There are 1 error(s), 0 warning(s), and 0 notifications(s). Here are the errors:193        **ERROR**194        ```195        Infra Failure196        ```197        ''').strip()198      ) +199      api.post_process(post_process.DropExpectation)200  )201  bug_msg = (202    'Something unexpected occurred'203    ' while running presubmit checks.'204    ' Please [file a bug](https://bugs.chromium.org'205    '/p/chromium/issues/entry?components='206    'Infra%3EClient%3EChrome&status=Untriaged)'207  )208  yield (209      api.test('failure-no-json') +210      api.runtime(is_experimental=False, is_luci=True) +211      api.buildbucket.try_build(project='infra') +212      api.step_data('presubmit', api.json.output(None, retcode=1)) +213      api.post_process(post_process.StatusException) +214      api.post_process(post_process.ResultReason, bug_msg) +215      api.post_process(post_process.DropExpectation)216  )217  yield (218      api.test('infra-failure-no-json') +219      api.runtime(is_experimental=False, is_luci=True) +220      api.buildbucket.try_build(project='infra') +221      api.step_data('presubmit', api.json.output(None, retcode=2)) +222      api.post_process(post_process.StatusException) +223      api.post_process(post_process.ResultReason, bug_msg) +224      api.post_process(post_process.DropExpectation)...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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
