How to use _check_timeout_msg method in avocado

Best Python code snippet using avocado_python

test_job_timeout.py

Source:test_job_timeout.py Github

copy

Full Screen

...77 n_skip = int(testsuite_tag.attributes['skipped'].value)78 self.assertEqual(n_skip, e_nskip,79 "Unexpected number of test skips, "80 "XML:\n%s" % xml_output)81 def _check_timeout_msg(self, idx):82 res_dir = os.path.join(self.tmpdir, "latest", "test-results")83 debug_log = glob.glob(os.path.join(res_dir, "%s-*" % idx, "debug.log"))84 debug_log = open(debug_log[0]).read()85 self.assertIn("Runner error occurred: Timeout reached", debug_log,86 "Runner error occurred: Timeout reached message not "87 "in the %sst test's debug.log:\n%s"88 % (idx, debug_log))89 self.assertIn("Traceback (most recent call last)", debug_log,90 "Traceback not present in the %sst test's debug.log:\n%s"91 % (idx, debug_log))92 def test_sleep_longer_timeout(self):93 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '94 '--xunit - --job-timeout=5 %s examples/tests/passtest.py' %95 (self.tmpdir, self.script.path))96 self.run_and_check(cmd_line, 0, 2, 0, 0, 0)97 def test_sleep_short_timeout(self):98 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '99 '--xunit - --job-timeout=1 %s examples/tests/passtest.py' %100 (self.tmpdir, self.script.path))101 self.run_and_check(cmd_line, exit_codes.AVOCADO_JOB_INTERRUPTED,102 2, 1, 0, 1)103 self._check_timeout_msg(1)104 def test_sleep_short_timeout_with_test_methods(self):105 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '106 '--xunit - --job-timeout=1 %s' %107 (self.tmpdir, self.py.path))108 self.run_and_check(cmd_line, exit_codes.AVOCADO_JOB_INTERRUPTED,109 3, 1, 0, 2)110 self._check_timeout_msg(1)111 def test_invalid_values(self):112 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '113 '--job-timeout=1,5 examples/tests/passtest.py' % self.tmpdir)114 result = process.run(cmd_line, ignore_status=True)115 self.assertEqual(result.exit_status, exit_codes.AVOCADO_FAIL)116 self.assertIn('Invalid value', result.stderr)117 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '118 '--job-timeout=123x examples/tests/passtest.py' % self.tmpdir)119 result = process.run(cmd_line, ignore_status=True)120 self.assertEqual(result.exit_status, exit_codes.AVOCADO_FAIL)121 self.assertIn('Invalid value', result.stderr)122 def test_valid_values(self):123 cmd_line = ('./scripts/avocado run --job-results-dir %s --sysinfo=off '124 '--job-timeout=123 examples/tests/passtest.py' % self.tmpdir)...

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