How to use run_sysinfo_interrupted method in avocado

Best Python code snippet using avocado_python

test_sysinfo.py

Source:test_sysinfo.py Github

copy

Full Screen

...60 msg = 'Avocado created sysinfo directory %s:\n%s' % (sysinfo_dir, result)61 self.assertFalse(os.path.isdir(sysinfo_dir), msg)62 def tearDown(self):63 shutil.rmtree(self.tmpdir)64 def run_sysinfo_interrupted(self, sleep, timeout, exp_duration):65 os.chdir(BASEDIR)66 commands_path = os.path.join(self.tmpdir, "commands")67 script.make_script(commands_path, "sleep %s" % sleep)68 config_path = os.path.join(self.tmpdir, "config.conf")69 script.make_script(config_path,70 COMMANDS_TIMEOUT_CONF % (timeout, commands_path))71 cmd_line = ("%s --show all --config %s run --job-results-dir %s "72 "--sysinfo=on passtest.py"73 % (AVOCADO, config_path, self.tmpdir))74 result = process.run(cmd_line)75 if timeout > 0:76 self.assertLess(result.duration, exp_duration, "Execution took "77 "longer than %ss which is likely due to "78 "malfunctioning commands_timeout "79 "sysinfo.collect feature:\n%s"80 % (exp_duration, result))81 else:82 self.assertGreater(result.duration, exp_duration, "Execution took "83 "less than %ss which is likely due to "84 "malfunctioning commands_timeout "85 "sysinfo.collect feature:\n%s"86 % (exp_duration, result))87 expected_rc = exit_codes.AVOCADO_ALL_OK88 self.assertEqual(result.exit_status, expected_rc,89 'Avocado did not return rc %d:\n%s'90 % (expected_rc, result))91 sleep_log = os.path.join(self.tmpdir, "latest", "sysinfo", "pre",92 "sleep %s" % sleep)93 if not os.path.exists(sleep_log):94 path = os.path.abspath(sleep_log)95 while not os.path.exists(path):96 tmp = os.path.split(path)[0]97 if tmp == path:98 break99 path = tmp100 raise AssertionError("Sleep output not recorded in '%s', first "101 "existing location '%s' contains:\n%s"102 % (sleep_log, path, os.listdir(path)))103 @unittest.skipIf(int(os.environ.get("AVOCADO_CHECK_LEVEL", 0)) < 2,104 "Skipping test that take a long time to run, are "105 "resource intensive or time sensitve")106 def test_sysinfo_interrupted(self):107 self.run_sysinfo_interrupted(10, 1, 15)108 @unittest.skipIf(int(os.environ.get("AVOCADO_CHECK_LEVEL", 0)) < 2,109 "Skipping test that take a long time to run, are "110 "resource intensive or time sensitve")111 def test_sysinfo_not_interrupted(self):112 self.run_sysinfo_interrupted(5, -1, 10)113if __name__ == '__main__':...

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