Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nf_core/components/components_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def display_nftest_output(self, nftest_out: bytes, nftest_err: bytes) -> None:
# update snapshot using nf-test --update-snapshot
self.generate_snapshot()

else:
elif nftest_err:
self.errors.append("nf-test failed")

def generate_snapshot(self) -> bool:
Expand Down
14 changes: 14 additions & 0 deletions tests/components/test_components_snapshot_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
from ..test_components import TestComponents


@pytest.mark.parametrize(
("nftest_err", "expected_errors"),
[(b"", []), (b"error", ["nf-test failed"]), (b"Different Snapshot:", [])],
)
def test_display_nftest_output_stderr(nftest_err, expected_errors):
"""Only report an nf-test failure when stderr is non-empty."""
tester = ComponentsTest.__new__(ComponentsTest)
tester.no_prompts = False
tester.update = False
tester.errors = []
tester.display_nftest_output(b"", nftest_err)
assert tester.errors == expected_errors


class TestTestComponentsUtils(TestComponents):
def test_components_test_check_inputs(self):
"""Test the check_inputs() function - raise UserWarning because module doesn't exist"""
Expand Down