We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b2c9155 commit 4a85fb7Copy full SHA for 4a85fb7
1 file changed
tests/test_qeventloop.py
@@ -11,6 +11,7 @@
11
import socket
12
import subprocess
13
import sys
14
+import time
15
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
16
17
import pytest
@@ -791,6 +792,22 @@ async def mycoro():
791
792
assert not loop.is_running()
793
794
795
+def test_slow_callback_duration_logging(loop, caplog):
796
+ async def mycoro():
797
+ time.sleep(1)
798
+
799
+ caplog.clear()
800
+ loop.set_debug(True)
801
+ loop.slow_callback_duration = 0.1
802
+ with caplog.at_level(logging.WARNING):
803
+ loop.run_until_complete(mycoro())
804
+ assert len(caplog.records) == 1
805
+ msg = caplog.records[0].message
806
+ assert "Executing" in msg
807
+ assert "took" in msg
808
+ assert "seconds" in msg
809
810
811
def teardown_module(module):
812
"""
813
Remove handlers from all loggers
0 commit comments