How to use gather_collectibles_config method in avocado

Best Python code snippet using avocado_python Github


Full Screen

...21from avocado.utils import path as utils_path22from avocado.utils import sysinfo23from avocado.utils.software_manager import manager24log = logging.getLogger("avocado.sysinfo")25def gather_collectibles_config(config):26 sysinfo_files = {}27 for collectible in ["commands", "files", "fail_commands", "fail_files"]:28 tmp_file = config.get(f"sysinfo.collectibles.{collectible}")29 if os.path.isfile(tmp_file):30"%s configured by file: %s", collectible.title(), tmp_file)31 sysinfo_files[collectible] = genio.read_all_lines(tmp_file)32 else:33 log.debug("File %s does not exist.", tmp_file)34 sysinfo_files[collectible] = []35 if "fail_" in collectible:36 list1 = sysinfo_files[collectible]37 list2 = sysinfo_files[collectible.split("_")[1]]38 sysinfo_files[collectible] = [tmp for tmp in list1 if tmp not in list2]39 return sysinfo_files40class SysInfo:41 """42 Log different system properties at some key control points.43 Includes support for a start and stop event, with daemons running in44 between. An event may be a job, a test, or any other event with a45 beginning and end.46 """47 def __init__(self, basedir=None, log_packages=None, profiler=None):48 """49 Set sysinfo collectibles.50 :param basedir: Base log dir where sysinfo files will be located.51 :param log_packages: Whether to log system packages (optional because52 logging packages is a costly operation). If not53 given explicitly, tries to look in the config54 files, and if not found, defaults to False.55 :param profiler: Whether to use the profiler. If not given explicitly,56 tries to look in the config files.57 """58 self.config = settings.as_dict()59 if basedir is None:60 basedir = utils_path.init_dir("sysinfo")61 self.basedir = basedir62 self._installed_pkgs = None63 if log_packages is None:64 packages_namespace = "sysinfo.collect.installed_packages"65 self.log_packages = self.config.get(packages_namespace)66 else:67 self.log_packages = log_packages68 self._get_collectibles(profiler)69 self.start_collectibles = set()70 self.end_collectibles = set()71 self.end_fail_collectibles = set()72 self.pre_dir = utils_path.init_dir(self.basedir, "pre")73 self.post_dir = utils_path.init_dir(self.basedir, "post")74 self.profile_dir = utils_path.init_dir(self.basedir, "profile")75 self._set_collectibles()76 def _get_collectibles(self, c_profiler):77 self.sysinfo_files = gather_collectibles_config(self.config)78 profiler = c_profiler79 if profiler is None:80 self.profiler = self.config.get("sysinfo.collect.profiler")81 else:82 self.profiler = profiler83 profiler_file = self.config.get("sysinfo.collectibles.profilers")84 if os.path.isfile(profiler_file):85 self.sysinfo_files["profilers"] = genio.read_all_lines(profiler_file)86"Profilers configured by file: %s", profiler_file)87 if not self.sysinfo_files["profilers"]:88 self.profiler = False89 if self.profiler is False:90 if not self.sysinfo_files["profilers"]:91"Profiler disabled: no profiler" " commands configured")...

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:


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?