Files
prettymaps/tests/test_app_runs.py
2025-05-16 20:09:31 -03:00

23 lines
700 B
Python

import subprocess
import sys
import time
import os
def test_streamlit_app_runs():
# Start the Streamlit app in headless mode
proc = subprocess.Popen(
[sys.executable, "-m", "streamlit", "run", os.path.abspath("app.py"), "--server.headless", "true"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
try:
# Wait a few seconds to see if it crashes
time.sleep(10)
# Check if the process is still running (should be)
assert proc.poll() is None, "Streamlit app crashed on startup"
finally:
proc.terminate()
try:
proc.wait(timeout=5)
except subprocess.TimeoutExpired:
proc.kill()