def _get_partitioning(storage, scheme, excluded_mount_points=()): """Get the partitioning requests for autopart. :param storage: blivet.Blivet instance :param scheme: a type of the partitioning scheme :param excluded_mount_points: a list of mount points to exclude :return: a list of full partitioning specs """ requests = [] for request in get_default_partitioning(): # Skip mount points excluded from the chosen scheme. if request.schemes and scheme not in request.schemes: continue # Skip excluded mount points. if (request.mountpoint or request.fstype) in excluded_mount_points: continue # Set the default filesystem type. if request.fstype is None: request.fstype = storage.get_fstype(request.mountpoint) # Update the size of swap. if request.fstype == "swap": disk_space = storage.get_disk_free_space() request.size = suggest_swap_size(disk_space=disk_space) requests.append(request) return requests
def _check_partitioning(self, config, partitioning): with patch("pyanaconda.modules.storage.partitioning.automatic.utils.platform") as platform: platform.partitions = [] with patch("pyanaconda.modules.storage.partitioning.automatic.utils.conf", new=config): default = get_default_partitioning() print("Default: " + repr(default)) print("Supplied: " + repr(partitioning)) assert default == partitioning
def _check_partitioning(self, config, partitioning): with patch( "pyanaconda.modules.storage.partitioning.automatic.utils.platform" ) as platform: platform.partitions = [] with patch( "pyanaconda.modules.storage.partitioning.automatic.utils.conf", new=config): self.assertEqual(get_default_partitioning(), partitioning)
def test_get_default_partitioning(self, platform): platform.partitions = [PartSpec("/boot")] requests = get_default_partitioning() assert ["/boot", "/", "/home"] == [spec.mountpoint for spec in requests]
def get_default_partitioning_test(self, platform): platform.partitions = [PartSpec("/boot")] requests = get_default_partitioning() self.assertEqual(["/boot", "/", "/home"], [spec.mountpoint for spec in requests])