Files
freqtrade/tests/commands/test_startup_time.py
2026-01-02 16:58:10 +01:00

21 lines
539 B
Python

import subprocess # noqa: S404, RUF100
import time
from tests.conftest import is_mac
MAXIMUM_STARTUP_TIME = 0.6 if is_mac() else 0.5
def test_startup_time():
# warm up to generate pyc
subprocess.run(["freqtrade", "-h"])
start = time.time()
subprocess.run(["freqtrade", "-h"])
elapsed = time.time() - start
assert elapsed < MAXIMUM_STARTUP_TIME, (
"The startup time is too long, try to use lazy import in the command entry function"
f" (maximum {MAXIMUM_STARTUP_TIME}s, got {elapsed}s)"
)