Skip to content

Commit

Permalink
fix AttributeError when reverse-depending on bundle: items
Browse files Browse the repository at this point in the history
  • Loading branch information
trehn committed Jun 8, 2018
1 parent 3e2cd3c commit 0c86cdd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bundlewrap/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,9 @@ def add_dep(item, dep):
if depending_item_id.startswith("bundle:"):
depending_bundle_name = depending_item_id.split(":")[1]
for depending_item in items.values():
if isinstance(depending_item, DummyItem):
# Type and TagItems don't have bundles
continue
if depending_item.bundle.name == depending_bundle_name:
add_dep(depending_item, item.id)

Expand Down
31 changes: 31 additions & 0 deletions tests/integration/bw_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,34 @@ def test_secret_identifier_twice(tmpdir):
assert run("bw test -s ''", path=str(tmpdir))[2] == 0
assert run("bw test -s 'test'", path=str(tmpdir))[2] == 0
assert run("bw test -s 'test,foo'", path=str(tmpdir))[2] == 0


def test_reverse_dummy_dep(tmpdir):
make_repo(
tmpdir,
nodes={
"node1": {
'bundles': ["bundle1", "bundle2"],
},
},
bundles={
"bundle1": {
'files': {
"/test": {
'content': "test",
},
},
},
"bundle2": {
'files': {
"/test2": {
'content': "test",
'needed_by': ["bundle:bundle1"],
},
},
},
},
)

stdout, stderr, rcode = run("bw test", path=str(tmpdir))
assert rcode == 0

0 comments on commit 0c86cdd

Please sign in to comment.