How to use _get_syslog_watcher method in avocado

Best Python code snippet using avocado_python

sysinfo.py

Source:sysinfo.py Github

copy

Full Screen

...378 self.pre_dir = utils_path.init_dir(self.basedir, 'pre')379 self.post_dir = utils_path.init_dir(self.basedir, 'post')380 self.profile_dir = utils_path.init_dir(self.basedir, 'profile')381 self._set_collectibles()382 def _get_syslog_watcher(self):383 logpaths = ["/var/log/messages",384 "/var/log/syslog",385 "/var/log/system.log"]386 for logpath in logpaths:387 if os.path.exists(logpath):388 return LogWatcher(logpath)389 raise ValueError("System log file not found (looked for %s)" %390 logpaths)391 def _set_collectibles(self):392 add_per_test = settings.get_value("sysinfo.collect", "per_test",393 bool, None)394 if self.profiler:395 for cmd in self.profilers:396 self.start_job_collectibles.add(Daemon(cmd))397 if add_per_test:398 self.start_test_collectibles.add(Daemon(cmd))399 for cmd in self.commands:400 self.start_job_collectibles.add(Command(cmd))401 self.end_job_collectibles.add(Command(cmd))402 if add_per_test:403 self.start_test_collectibles.add(Command(cmd))404 self.end_test_collectibles.add(Command(cmd))405 for filename in self.files:406 self.start_job_collectibles.add(Logfile(filename))407 self.end_job_collectibles.add(Logfile(filename))408 if add_per_test:409 self.start_test_collectibles.add(Logfile(filename))410 self.end_test_collectibles.add(Logfile(filename))411 # As the system log path is not standardized between distros,412 # we have to probe and find out the correct path.413 try:414 self.end_test_collectibles.add(self._get_syslog_watcher())415 except ValueError as details:416 log.info(details)417 self.end_test_collectibles.add(JournalctlWatcher())418 def _get_collectibles(self, hook):419 collectibles = self.hook_mapping.get(hook)420 if collectibles is None:421 raise ValueError('Incorrect hook, valid hook names: %s' %422 self.hook_mapping.keys())423 return collectibles424 def add_cmd(self, cmd, hook):425 """426 Add a command collectible.427 :param cmd: Command to log.428 :param hook: In which hook this cmd should be logged (start job, end...

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