Skip to content

Commit 4b97bd4

Browse files
zkoppertCopilot
andcommitted
fix: wrap ecosystem test loop in self.subTest for better isolation
Adds self.subTest(ecosystem=..., manifest_file=...) so all manifest variants run even if one fails, matching the docstring's stated intent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 80643f2 commit 4b97bd4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test_dependabot_file.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,13 +409,14 @@ def test_build_dependabot_file_with_new_ecosystems(self):
409409
("vcpkg", "vcpkg-configuration.json"),
410410
]
411411
for ecosystem, manifest_file in ecosystems:
412-
repo = MagicMock()
413-
repo.file_contents.side_effect = lambda f, mf=manifest_file: f == mf
414-
expected = yaml.load(tmpl.format(ecosystem).encode())
415-
result = build_dependabot_file(
416-
repo, False, [], {}, None, "weekly", "", [], None
417-
)
418-
self.assertEqual(result, expected)
412+
with self.subTest(ecosystem=ecosystem, manifest_file=manifest_file):
413+
repo = MagicMock()
414+
repo.file_contents.side_effect = lambda f, mf=manifest_file: f == mf
415+
expected = yaml.load(tmpl.format(ecosystem).encode())
416+
result = build_dependabot_file(
417+
repo, False, [], {}, None, "weekly", "", [], None
418+
)
419+
self.assertEqual(result, expected)
419420

420421
def test_build_dependabot_file_with_terraform_with_files(self):
421422
"""Test that the dependabot.yml file is built correctly with Terraform"""

0 commit comments

Comments
 (0)