vllm/tests/test_logger.py

28 lines
465 B
Python
Raw Normal View History

import os
import sys
import tempfile
from vllm.logger import enable_trace_function_call
def f1(x):
return f2(x)
def f2(x):
return x
def test_trace_function_call():
fd, path = tempfile.mkstemp()
cur_dir = os.path.dirname(__file__)
enable_trace_function_call(path, cur_dir)
f1(1)
with open(path, 'r') as f:
content = f.read()
assert "f1" in content
assert "f2" in content
sys.settrace(None)
os.remove(path)