Skip to content

Commit 343c970

Browse files
committed
test that 'running coverage' string doesn't spam output
1 parent f9ae3e9 commit 343c970

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

scripts/torch_ci/test_entrypoint.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""Unit tests for entrypoint.py."""
22

3-
import unittest
4-
from unittest.mock import Mock
3+
import io
54
import pathlib
65
import shutil
6+
import unittest
7+
from unittest.mock import Mock, patch
78

89
from scripts.torch_ci.entrypoint import CoverageRunner, CommandExecutor
910

@@ -61,6 +62,12 @@ def test_format_results_table(self):
6162
self.assertIn("op1", table)
6263
self.assertIn("PASS", table)
6364

65+
@patch("sys.stdout", new_callable=io.StringIO)
66+
def test_run_all_no_spam_stdout(self, mock_stdout):
67+
self.mock_executor.run.return_value = Mock(returncode=0, stderr="")
68+
self.runner.run_all()
69+
self.assertNotIn("Running coverage for", mock_stdout.getvalue())
70+
6471

6572
if __name__ == "__main__":
6673
unittest.main()

0 commit comments

Comments
 (0)