freqtrade_origin/tests/commands/test_startup_time.py

18 lines
399 B
Python
Raw Normal View History

2024-10-03 04:07:03 +00:00
import subprocess
import time
MAXIMUM_STARTUP_TIME = 0.5
def test_startup_time():
2024-10-04 03:52:07 +00:00
# warm up to generate pyc
subprocess.run(["freqtrade", "-h"])
2024-10-03 04:07:03 +00:00
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"