from ruamel.yaml.scanner import ScannerError

import pytest
import mk.source

# noinspection PyUnresolvedReferences
from .fixtures import mkprimary, mkerror, mkroots


def test_primary_source(mkprimary):
    for source in mk.source.make_sources_from_file_yaml(*mkprimary):
        assert source.source in ("primary_file", "other_source")
        assert str(source.location.path_abs).endswith("primary.mk.yaml")
        assert type(source.make) is list


def test_error_1(mkroots):
    with pytest.raises(ScannerError) as ex:
        for _ in mk.source.make_sources_from_file_yaml(
            *mkroots["errors"]["error1.mk.yaml"]
        ):
            pass
    msg = str(ex.value)
    assert "error1.mk.yaml" in msg

@@ -69,16 +69,49 @@
 k.source
+%0Afrom mk.location import Location
 %0A%0A# noin
@@ -224,84 +224,195 @@
 e(mk
-primary):%0A    for source in mk.source.make_sources_from_file_yaml(*mkprimary
+roots):%0A    path_root, path_rel = mkroots%5B%22base%22%5D%5B%22primary.mk.yaml%22%5D%0A    for source in mk.source.make_sources_from_file_yaml(%0A        Location(path_root=path_root, path_rel=path_rel)%0A    
 ):%0A 
@@ -614,24 +614,86 @@
 1(mkroots):%0A
+    path_root, path_rel = mkroots%5B%22errors%22%5D%5B%22error1.mk.yaml%22%5D%0A
     with pyt
@@ -796,44 +796,56 @@
     
-*mkroots%5B%22errors%22%5D%5B%22error1.mk.yaml%22%5D
+Location(path_root=path_root, path_rel=path_rel)
 %0A   

fix tests