MCPcopy
hub / github.com/treeverse/dvc / test_progress_awareness

Method test_progress_awareness

tests/unit/test_logger.py:174–202  ·  view source on GitHub ↗
(self, mocker, capsys, caplog)

Source from the content-addressed store, hash-verified

172 assert "dvc.exceptions.DvcException: second" in stack_trace
173
174 def test_progress_awareness(self, mocker, capsys, caplog):
175 from dvc.progress import Tqdm
176
177 mocker.patch("sys.stdout.isatty", return_value=True)
178 with Tqdm(total=100, desc="progress") as pbar:
179 pbar.update()
180
181 # logging an invisible message should not break
182 # the progress bar output
183 with caplog.at_level(logging.INFO, logger="dvc"):
184 debug_record = logging.LogRecord(
185 name="dvc",
186 level=logging.DEBUG,
187 pathname=__name__,
188 lineno=1,
189 msg="debug",
190 args=(),
191 exc_info=None,
192 )
193
194 formatter.format(debug_record)
195 captured = capsys.readouterr()
196 assert not captured.out
197
198 # when the message is actually visible
199 with caplog.at_level(logging.INFO, logger="dvc"):
200 logger.info("some info")
201 captured = capsys.readouterr()
202 assert not captured.out
203
204
205def test_handlers():

Callers

nothing calls this directly

Calls 4

TqdmClass · 0.90
updateMethod · 0.45
formatMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected