# Path: shipwright/_lib/dependencies.py
# def eval(build_targets, targets):
# def _find(tree, name):
#     def find_(loc):
# def _make_tree(images):
#         def is_child(target):
# def _replace(node, children):
# def _children(item):
# def _is_branch(item):
# def _make_node(node, children):
# def _breadth_first_iter(loc):
# def _lineage(loc):
# def _split(f, children):
# def _brood(loc):
# def _upto(target, tree):
# def _dependents(target, tree):
# def _exact(target, tree):
# def _exclude(target, tree):
# 
# Path: shipwright/_lib/image.py
# def list_images(namespace, name_map, root_path):
# def image_name(namespace, name_map, root_path, path):
# def build_files(build_root):
# def name(docker_path):
# def sub_if(ex, repl, string, flags):
# def parse_copy(cmd):
# def copy_paths(docker_path):
#     def join(path):
#     def copy_paths_gen():
# def parent(docker_path):
# 
# Path: shipwright/_lib/source_control.py
# def source_control(path, namespace, name_map, mode=None):
#     if mode is None:
#         mode = AUTO
#     assert isinstance(mode, Mode)
#     the_mode = mode if mode is not AUTO else get_mode(path)
#     for cls in SourceControl.__subclasses__():
#         if cls.mode is the_mode:
#             return cls(path, namespace, name_map)


from shipwright._lib import dependencies, image, source_control
    bt['upto'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/1', 'shipwright_test/2']


def test_dependents():
    bt = default_build_targets()
    bt['dependents'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == [
        'shipwright_test/1', 'shipwright_test/2', 'shipwright_test/3',
    ]


def test_exact():
    bt = default_build_targets()
    bt['exact'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/2']


def test_exclude():
    bt = default_build_targets()
    bt['exclude'] = ['shipwright_test/2', 'fake_exclude']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/1', 'shipwright_test/independent']


def test_breadth_first_iter():
    bt = default_build_targets()

# Path: shipwright/_lib/dependencies.py
# def eval(build_targets, targets):
# def _find(tree, name):
#     def find_(loc):
# def _make_tree(images):
#         def is_child(target):
# def _replace(node, children):
# def _children(item):
# def _is_branch(item):
# def _make_node(node, children):
# def _breadth_first_iter(loc):
# def _lineage(loc):
# def _split(f, children):
# def _brood(loc):
# def _upto(target, tree):
# def _dependents(target, tree):
# def _exact(target, tree):
# def _exclude(target, tree):
# 
# Path: shipwright/_lib/image.py
# def list_images(namespace, name_map, root_path):
# def image_name(namespace, name_map, root_path, path):
# def build_files(build_root):
# def name(docker_path):
# def sub_if(ex, repl, string, flags):
# def parse_copy(cmd):
# def copy_paths(docker_path):
#     def join(path):
#     def copy_paths_gen():
# def parent(docker_path):
# 
# Path: shipwright/_lib/source_control.py
# def source_control(path, namespace, name_map, mode=None):
#     if mode is None:
#         mode = AUTO
#     assert isinstance(mode, Mode)
#     the_mode = mode if mode is not AUTO else get_mode(path)
#     for cls in SourceControl.__subclasses__():
#         if cls.mode is the_mode:
#             return cls(path, namespace, name_map)


# Path: tests/test_dependencies.py
from shipwright._lib import dependencies, image, source_control

    bt['upto'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/1', 'shipwright_test/2']


def test_dependents():
    bt = default_build_targets()
    bt['dependents'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == [
        'shipwright_test/1', 'shipwright_test/2', 'shipwright_test/3',
    ]


def test_exact():
    bt = default_build_targets()
    bt['exact'] = ['shipwright_test/2']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/2']


def test_exclude():
    bt = default_build_targets()
    bt['exclude'] = ['shipwright_test/2', 'fake_exclude']
    result = names_list(dependencies.eval(bt, targets))
    assert result == ['shipwright_test/1', 'shipwright_test/independent']


def test_breadth_first_iter():
    bt = default_build_targets()

    results = [result.name for result in dependencies.eval(bt, targets)]