# Path: mapchete/cli/main.py
# @with_plugins(commands)
# @click.version_option(version=__version__, message="%(version)s")
# @click.group()
# def main():
#     pass
# 
# Path: mapchete/cli/options.py
# MULTIPROCESSING_START_METHODS = get_all_start_methods()
# def _validate_zoom(ctx, param, zoom):
# def _validate_bounds(ctx, param, bounds):
# def _validate_crs(ctx, param, crs):
# def _validate_mapchete_files(ctx, param, mapchete_files):
# def _set_debug_log_level(ctx, param, debug):
# def _setup_logfile(ctx, param, logfile):
# def _cb_key_val(ctx, param, value):
# def _cb_none_concurrency(ctx, param, value):
# 
# Path: mapchete/errors.py
# class MapcheteProcessOutputError(ValueError):
#     """Raised when a mapchete process output is invalid."""


from click.testing import CliRunner
from shapely import wkt
from shapely.geometry import shape
from rasterio.io import MemoryFile
from rio_cogeo.cogeo import cog_validate
from mapchete.cli.main import main as mapchete_cli
from mapchete.cli import options
from mapchete.errors import MapcheteProcessOutputError
import fiona
import geobuf
import os
import pytest
import shapely.geos
import rasterio
import warnings
import yaml
import mapchete
            "-f",
        ]
    )
    assert not os.path.exists(os.path.join(*[out_path, "5", "3", "7.tif"]))


def test_rm_storage_option_errors(cleantopo_br):
    out_path = os.path.join(TESTDATA_DIR, cleantopo_br.dict["output"]["path"])
    run_cli(
        [
            "rm",
            out_path,
            "-z",
            "5",
            "-b",
            "169.19251592399996",
            "-90",
            "180",
            "-80.18582802550002",
            "-f",
            "--fs-opts",
            "invalid_opt",
        ],
        output_contains="Error: Invalid value for '--fs-opts': Invalid syntax for KEY=VAL arg: invalid_opt",
        expected_exit_code=2,
        raise_exc=False,
    )


def test_fs_opt_extractor():

# Path: mapchete/cli/main.py
# @with_plugins(commands)
# @click.version_option(version=__version__, message="%(version)s")
# @click.group()
# def main():
#     pass
# 
# Path: mapchete/cli/options.py
# MULTIPROCESSING_START_METHODS = get_all_start_methods()
# def _validate_zoom(ctx, param, zoom):
# def _validate_bounds(ctx, param, bounds):
# def _validate_crs(ctx, param, crs):
# def _validate_mapchete_files(ctx, param, mapchete_files):
# def _set_debug_log_level(ctx, param, debug):
# def _setup_logfile(ctx, param, logfile):
# def _cb_key_val(ctx, param, value):
# def _cb_none_concurrency(ctx, param, value):
# 
# Path: mapchete/errors.py
# class MapcheteProcessOutputError(ValueError):
#     """Raised when a mapchete process output is invalid."""


# Path: test/test_cli.py
from click.testing import CliRunner
from shapely import wkt
from shapely.geometry import shape
from rasterio.io import MemoryFile
from rio_cogeo.cogeo import cog_validate
from mapchete.cli.main import main as mapchete_cli
from mapchete.cli import options
from mapchete.errors import MapcheteProcessOutputError
import fiona
import geobuf
import os
import pytest
import shapely.geos
import rasterio
import warnings
import yaml
import mapchete

            "-f",
        ]
    )
    assert not os.path.exists(os.path.join(*[out_path, "5", "3", "7.tif"]))


def test_rm_storage_option_errors(cleantopo_br):
    out_path = os.path.join(TESTDATA_DIR, cleantopo_br.dict["output"]["path"])
    run_cli(
        [
            "rm",
            out_path,
            "-z",
            "5",
            "-b",
            "169.19251592399996",
            "-90",
            "180",
            "-80.18582802550002",
            "-f",
            "--fs-opts",
            "invalid_opt",
        ],
        output_contains="Error: Invalid value for '--fs-opts': Invalid syntax for KEY=VAL arg: invalid_opt",
        expected_exit_code=2,
        raise_exc=False,
    )


def test_fs_opt_extractor():

    kwargs = options._cb_key_val(