Best Python code snippet using avocado_python
sysinfo.py
Source:sysinfo.py  
...83        help_msg = (84            "File with list of commands that will be executed and "85            "have their output collected"86        )87        default = system_wide_or_base_path("etc/avocado/sysinfo/commands")88        settings.register_option(89            section="sysinfo.collectibles",90            key="commands",91            key_type=prepend_base_path,92            default=default,93            help_msg=help_msg,94        )95        help_msg = (96            "File with list of commands that will be executed and "97            "have their output collected, in case of failed test"98        )99        default = system_wide_or_base_path("etc/avocado/sysinfo/fail_commands")100        settings.register_option(101            section="sysinfo.collectibles",102            key="fail_commands",103            key_type=prepend_base_path,104            default=default,105            help_msg=help_msg,106        )107        help_msg = "File with list of files that will be collected verbatim"108        default = system_wide_or_base_path("etc/avocado/sysinfo/files")109        settings.register_option(110            section="sysinfo.collectibles",111            key="files",112            key_type=prepend_base_path,113            default=default,114            help_msg=help_msg,115        )116        help_msg = (117            "File with list of files that will be collected verbatim"118            ", in case of failed test"119        )120        default = system_wide_or_base_path("etc/avocado/sysinfo/fail_files")121        settings.register_option(122            section="sysinfo.collectibles",123            key="fail_files",124            key_type=prepend_base_path,125            default=default,126            help_msg=help_msg,127        )128        help_msg = "File with list of commands that will run alongside the job/test"129        default = system_wide_or_base_path("etc/avocado/sysinfo/profilers")130        settings.register_option(131            section="sysinfo.collectibles",132            key="profilers",133            key_type=prepend_base_path,134            default=default,135            help_msg=help_msg,136        )137class SysInfoJob(JobPreTests, JobPostTests):138    name = "sysinfo"139    description = "Collects system information before/after the job is run"140    def __init__(self, config):141        self.sysinfo = None142        self.sysinfo_enabled = config.get("sysinfo.collect.enabled")143    def _init_sysinfo(self, job_logdir):...path.py
Source:path.py  
...5    if not expanded.startswith(("/", "~", ".")):6        dist = get_distribution("avocado-framework")7        return os.path.join(dist.location, "avocado", expanded)8    return expanded9def system_wide_or_base_path(file_path):10    """Returns either a system wide path, or one relative to the base.11    If "etc/avocado/avocado.conf" is given as input, it checks for the12    existence of "/etc/avocado/avocado.conf".  If that path does not exist,13    then a path starting with the avocado's Python's distribution is returned.14    In that case it'd return something like15    "/usr/lib/python3.9/site-packages/avocado/etc/avocado/avocado.conf".16    :param file_path: a filesystem path that can either be absolute, or17                      relative.  If relative, the absolute equivalent18                      (that is, by prefixing the filesystem root location)19                      is checked for existence.  If it does not exist, a20                      path relative to the Python's distribution base path21                      is returned.22    :type file_path: str23    :rtype: str...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!!
