Cannot get simple testing to work (timeout)

app/
├── app.py
└── tests/
   └── gui_tests/
        └── test_app.py

app.py:

import streamlit as st

st.text("hello world")

test_app.py:

from streamlit.testing.v1 import AppTest
from pathlib import Path

def test_gui():
    at = AppTest.from_file(Path(__file__).parents[2] / 'app.py')
    at.run()
    assert not at.exception

When running this with pytest I get a timeout error:

>       raise RuntimeError(err_string)
E       RuntimeError: AppTest script run timed out after 3(s)

I have no clue why.

If you run pytest from the root app/ folder, and change the first line of your test to

at = AppTest.from_file('app.py')

This works for me

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.