mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-16 21:53:45 +00:00
* test: add blocking IO detector * test: add blocking IO probe option * test: harden blocking IO probe lifecycle * test: move blocking io detector to support
23 lines
554 B
Python
23 lines
554 B
Python
from __future__ import annotations
|
|
|
|
import time
|
|
|
|
import pytest
|
|
|
|
ORIGINAL_SLEEP = time.sleep
|
|
|
|
|
|
def replacement_sleep(seconds: float) -> None:
|
|
return None
|
|
|
|
|
|
def test_probe_survives_monkeypatch_teardown(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
monkeypatch.setattr(time, "sleep", replacement_sleep)
|
|
assert time.sleep is replacement_sleep
|
|
|
|
|
|
@pytest.mark.no_blocking_io_probe
|
|
def test_probe_restores_original_after_monkeypatch_teardown() -> None:
|
|
assert time.sleep is ORIGINAL_SLEEP
|
|
assert getattr(time.sleep, "__wrapped__", None) is None
|