# Path: shipwright/exceptions.py

# 
# Path: shipwright/targets.py



import pkg_resources
import pytest
from shipwright import exceptions, targets
from . import utils
    tmp = tmpdir.join('shipwright-sample')
    path = str(tmp)
    source = pkg_resources.resource_filename(
        __name__,
        'examples/shipwright-sample',
    )
    repo = utils.create_repo(path, source)
    commit = repo.head.ref.commit.hexsha[:12]
    assert targets.targets(path=path, upto=['shared'], tags=['ham/spam']) == [
        'shipwright/base:' + commit,
        'shipwright/base:ham-spam',
        'shipwright/base:master',
        'shipwright/base:' + commit,
        'shipwright/shared:' + commit,
        'shipwright/shared:ham-spam',
        'shipwright/shared:master',
        'shipwright/shared:' + commit,
    ]


def test_no_repo(tmpdir):
    tmp = tmpdir.join('shipwright-sample')
    path = str(tmp)
    source = pkg_resources.resource_filename(
        __name__,
        'examples/shipwright-sample',
    )
    utils.create_repo(path, source)
    tmp.join('.git').remove(rec=1)
    with pytest.raises(exceptions.SourceControlNotFound):

# Path: shipwright/exceptions.py

# 
# Path: shipwright/targets.py



# Path: tests/integration/test_targets.py
import pkg_resources
import pytest
from shipwright import exceptions, targets
from . import utils

    tmp = tmpdir.join('shipwright-sample')
    path = str(tmp)
    source = pkg_resources.resource_filename(
        __name__,
        'examples/shipwright-sample',
    )
    repo = utils.create_repo(path, source)
    commit = repo.head.ref.commit.hexsha[:12]
    assert targets.targets(path=path, upto=['shared'], tags=['ham/spam']) == [
        'shipwright/base:' + commit,
        'shipwright/base:ham-spam',
        'shipwright/base:master',
        'shipwright/base:' + commit,
        'shipwright/shared:' + commit,
        'shipwright/shared:ham-spam',
        'shipwright/shared:master',
        'shipwright/shared:' + commit,
    ]


def test_no_repo(tmpdir):
    tmp = tmpdir.join('shipwright-sample')
    path = str(tmp)
    source = pkg_resources.resource_filename(
        __name__,
        'examples/shipwright-sample',
    )
    utils.create_repo(path, source)
    tmp.join('.git').remove(rec=1)
    with pytest.raises(exceptions.SourceControlNotFound):

        targets.targets(path=path)