1515from servicelib .progress_bar import (
1616 _INITIAL_VALUE ,
1717 _MIN_PROGRESS_UPDATE_PERCENT ,
18+ _PROGRESS_ALREADY_REACGED_MAXIMUM ,
1819 ProgressBarData ,
1920)
2021
@@ -258,7 +259,8 @@ async def test_set_progress(caplog: pytest.LogCaptureFixture, faker: Faker):
258259 assert root ._current_steps == pytest .approx (34 ) # noqa: SLF001
259260 await root .set_ (58 )
260261 assert root ._current_steps == pytest .approx (50 ) # noqa: SLF001
261- assert "already reached maximum" in caplog .messages [0 ]
262+ assert "WARNING" in caplog .text
263+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM in caplog .messages [0 ]
262264 assert "TIP:" in caplog .messages [0 ]
263265
264266
@@ -269,24 +271,29 @@ async def test_reset_progress(caplog: pytest.LogCaptureFixture, faker: Faker):
269271 assert root .step_weights is None
270272 await root .set_ (50 )
271273 assert root ._current_steps == pytest .approx (50 ) # noqa: SLF001
272- assert "already reached maximum" not in caplog .text
274+ assert "WARNING" not in caplog .text
275+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM not in caplog .text
273276 await root .set_ (51 )
274277 assert root ._current_steps == pytest .approx (50 ) # noqa: SLF001
275- assert "already reached maximum" in caplog .text
278+ assert "WARNING" in caplog .text
279+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM in caplog .text
276280
277281 caplog .clear ()
278282 root .reset ()
279283
280284 assert root ._current_steps == pytest .approx (- 1 ) # noqa: SLF001
281- assert "already reached maximum" not in caplog .text
285+ assert "WARNING" not in caplog .text
286+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM not in caplog .text
282287
283288 await root .set_ (12 )
284289 assert root ._current_steps == pytest .approx (12 ) # noqa: SLF001
285- assert "already reached maximum" not in caplog .text
290+ assert "WARNING" not in caplog .text
291+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM not in caplog .text
286292
287293 await root .set_ (51 )
288294 assert root ._current_steps == pytest .approx (50 ) # noqa: SLF001
289- assert "already reached maximum" in caplog .text
295+ assert "WARNING" in caplog .text
296+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM in caplog .text
290297
291298
292299async def test_concurrent_progress_bar (faker : Faker ):
@@ -331,7 +338,7 @@ async def test_too_many_updates_does_not_raise_but_show_warning_with_stack(
331338 await root .update ()
332339 await root .update ()
333340 await root .update ()
334- assert "already reached maximum" in caplog .messages [0 ]
341+ assert _PROGRESS_ALREADY_REACGED_MAXIMUM in caplog .messages [0 ]
335342 assert "TIP:" in caplog .messages [0 ]
336343
337344
0 commit comments