# Path: boussole/exceptions.py
# class UnresolvablePath(BoussoleBaseException):
#     """
#     Exception to be raised when the resolver can not resolve a given path.
#     """
#     pass
# 
# Path: boussole/exceptions.py
# class UnclearResolution(BoussoleBaseException):
#     """
#     Exception to be raised when the resolver encounts multiple existing
#     candidates for a path.
#     """
#     pass


import os
import pytest
from boussole.exceptions import UnresolvablePath
from boussole.exceptions import UnclearResolution


def test_basic(settings, parser, resolver):
    """Resolve paths from basic sample"""
    sourcepath = os.path.join(settings.sample_path, 'main_basic.scss')
    with open(sourcepath) as fp:
        finded_paths = parser.parse(fp.read())

    resolved_paths = resolver.resolve(sourcepath, finded_paths)

    assert resolved_paths == [
        os.path.join(settings.sample_path, '_vendor.scss'),
        os.path.join(settings.sample_path, '_empty.scss'),
    ]


def test_library(settings, parser, resolver):
    """Resolve paths from main_using_libs.scss
    that use included libraries"""
    sourcepath = os.path.join(settings.sample_path, 'main_using_libs.scss')
    with open(sourcepath) as fp:
        finded_paths = parser.parse(fp.read())

    resolved_paths = resolver.resolve(
        sourcepath,
        finded_paths,
        library_paths=settings.libraries_fixture_paths
    )

    assert resolved_paths == [

# Path: boussole/exceptions.py
# class UnresolvablePath(BoussoleBaseException):
#     """
#     Exception to be raised when the resolver can not resolve a given path.
#     """
#     pass
# 
# Path: boussole/exceptions.py
# class UnclearResolution(BoussoleBaseException):
#     """
#     Exception to be raised when the resolver encounts multiple existing
#     candidates for a path.
#     """
#     pass


# Path: tests/003_resolver/010_resolving.py
import os
import pytest
from boussole.exceptions import UnresolvablePath
from boussole.exceptions import UnclearResolution



def test_basic(settings, parser, resolver):
    """Resolve paths from basic sample"""
    sourcepath = os.path.join(settings.sample_path, 'main_basic.scss')
    with open(sourcepath) as fp:
        finded_paths = parser.parse(fp.read())

    resolved_paths = resolver.resolve(sourcepath, finded_paths)

    assert resolved_paths == [
        os.path.join(settings.sample_path, '_vendor.scss'),
        os.path.join(settings.sample_path, '_empty.scss'),
    ]


def test_library(settings, parser, resolver):
    """Resolve paths from main_using_libs.scss
    that use included libraries"""
    sourcepath = os.path.join(settings.sample_path, 'main_using_libs.scss')
    with open(sourcepath) as fp:
        finded_paths = parser.parse(fp.read())

    resolved_paths = resolver.resolve(
        sourcepath,
        finded_paths,
        library_paths=settings.libraries_fixture_paths
    )

    assert resolved_paths == [

        os.path.join(settings.lib2_path, 'addons/_some_addon.scss'),