mirror of
https://github.com/marceloprates/prettymaps.git
synced 2025-08-30 17:50:13 +02:00
23 lines
700 B
Python
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() |