Best Python code snippet using autotest_python
partition.py
Source:partition.py  
...276            eventually the test277    """278    # setup the filesystem parameters for all the partitions279    for p in partitions:280        p.set_fs_options(fs_opt)281    # make and mount all the partitions in parallel282    parallel(partitions, 'setup_before_test', mountpoint_func=mountpoint_func)283    mountpoint = mountpoint_func(partitions[0])284    # run the test against all the partitions285    job.run_test(test, tag=tag, partitions=partitions, dir=mountpoint, **dargs)286    parallel(partitions, 'unmount')  # unmount all partitions in parallel287    if do_fsck:288        parallel(partitions, 'fsck')  # fsck all partitions in parallel289    # else fsck is done by caller290class partition(object):291    """292    Class for handling partitions and filesystems293    """294    def __init__(self, job, device, loop_size=0, mountpoint=None):295        """296        @param job: A L{client.bin.job} instance.297        @param device: The device in question (e.g."/dev/hda2"). If device is a298                file it will be mounted as loopback.299        @param loop_size: Size of loopback device (in MB). Defaults to 0.300        """301        self.device = device302        self.name = os.path.basename(device)303        self.job = job304        self.loop = loop_size305        self.fstype = None306        self.mountpoint = mountpoint307        self.mkfs_flags = None308        self.mount_options = None309        self.fs_tag = None310        if self.loop:311            cmd = 'dd if=/dev/zero of=%s bs=1M count=%d' % (device, loop_size)312            utils.system(cmd)313    def __repr__(self):314        return '<Partition: %s>' % self.device315    def set_fs_options(self, fs_options):316        """317        Set filesystem options318            @param fs_options: A L{FsOptions} object319        """320        self.fstype = fs_options.fstype321        self.mkfs_flags = fs_options.mkfs_flags322        self.mount_options = fs_options.mount_options323        self.fs_tag = fs_options.fs_tag324    def run_test(self, test, **dargs):325        self.job.run_test(test, dir=self.get_mountpoint(), **dargs)326    def setup_before_test(self, mountpoint_func):327        """328        Prepare a partition for running a test.  Unmounts any329        filesystem that's currently mounted on the partition, makes a...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!!
