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