| 1 | # SPDX-License-Identifier: Apache-2.0 |
| 2 | # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
| 3 | |
| 4 | import pytest |
| 5 | |
| 6 | from vllm.utils import jit_monitor |
| 7 | |
| 8 | |
| 9 | @pytest.fixture(autouse=True) |
| 10 | def _reset_monitor(): |
| 11 | """Reset global monitor state between tests. |
| 12 | |
| 13 | ``activate()`` installs process-global hooks and flips module globals, so |
| 14 | without this every test would inherit the previous test's monitor state. |
| 15 | """ |
| 16 | |
| 17 | def reset(): |
| 18 | jit_monitor._active = False |
| 19 | jit_monitor._mode = "warn" |
| 20 | jit_monitor._verbose = False |
| 21 | jit_monitor._cutedsl_hook_installed = False |
| 22 | jit_monitor._tilelang_hook_installed = False |
| 23 | jit_monitor._tilelang_jitimpl_compile_depth = 0 |
| 24 | |
| 25 | reset() |
| 26 | yield |
| 27 | reset() |