checking for error log lines during startup test

This commit is contained in:
John Lancaster
2024-08-13 00:16:26 -05:00
parent 77f859855c
commit 2484668b26

View File

@@ -41,6 +41,8 @@ def test_startup(ad: AppDaemon, caplog: pytest.LogCaptureFixture):
with caplog.at_level(logging.DEBUG): with caplog.at_level(logging.DEBUG):
ad.loop.run_until_complete(asyncio.sleep(2.0)) ad.loop.run_until_complete(asyncio.sleep(2.0))
error_log_lines = [msg for name, lvl, msg in caplog.record_tuples if name.startswith('Error')]
assert len(error_log_lines) == 0
assert "Started 'hello_world'" in caplog.text assert "Started 'hello_world'" in caplog.text
assert 'App initialization complete' in caplog.text assert 'App initialization complete' in caplog.text