File tree 1 file changed +33
-0
lines changed 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -482,3 +482,36 @@ def custom_trace(*args):
482
482
module .custom_trace = custom_trace
483
483
484
484
assert pytest_timeout .is_debugging (custom_trace )
485
+
486
+
487
+ def test_logging_customization (testdir ):
488
+ testdir .makepyfile (
489
+ conftest = """
490
+ import pytest
491
+
492
+ @pytest.hookimpl(hookwrapper=True)
493
+ def pytest_runtest_makereport(item, call):
494
+ r = yield
495
+ if not hasattr(r, "get_result"):
496
+ return
497
+ report = r.get_result()
498
+ timed_out = False
499
+ if hasattr(call.excinfo, "value"):
500
+ msg = getattr(call.excinfo.value, "msg", None)
501
+ if isinstance(msg, str) and msg.startswith("Timeout >"):
502
+ timed_out = True
503
+ assert bool(getattr(report, "timed_out", None)) == timed_out
504
+ """
505
+ )
506
+ testdir .makepyfile (
507
+ """
508
+ import time
509
+
510
+ def test_times_out():
511
+ time.sleep(2)
512
+
513
+ def test_does_not_time_out():
514
+ time.sleep(0.1)
515
+ """
516
+ )
517
+ testdir .runpytest ("--timeout=1" , "-ss" )
You can’t perform that action at this time.
0 commit comments