def METHOD_NAME(
    tmpdir, mock_partition_manager_valid_switch: MagicMock
):
    """Test that decomp_and_write function raises RunTime Error when it fails."""
    updater = OT3UpdateActions(
        root_FS_intf=RootFSInterface(),
        part_mngr=mock_partition_manager_valid_switch,
    )
    rfs_path = os.path.join(tmpdir, "rootfs.xz")
    with lzma.open(rfs_path, "w") as f:
        f.write(os.urandom(400000))
    with mock.patch(
        "otupdate.openembedded.update_actions.PartitionManager.get_partition_size",
        mock.Mock(return_value=1),
    ):
        # make sure we catch RunTime Exception if the update size is larger than the partition size
        try:
            updater.decomp_and_write(rfs_path, lambda x: x(2))
            assert (
                False
            ), "Did not raise RunTime error when update file is larger than partition."
        except RuntimeError:
            assert True, ""