diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/demo_wv.py b/src/apptest/demo_wv.py similarity index 67% rename from src/demo_wv.py rename to src/apptest/demo_wv.py index 1ad2e3c..e951116 100644 --- a/src/demo_wv.py +++ b/src/apptest/demo_wv.py @@ -6,8 +6,18 @@ # - TODO: find a cleaner solution for organisation (maybe just config to pytest?) import streamlit as st -import whale_viewer as sw_wv +# to run streamlit from this subdir, we need the the src dir on the path +# NOTE: pytest doesn't need this to run the tests, but to develop the test +# harness is hard without running streamlit +import sys +from os import path +# src (parent from here) +src_dir = path.dirname( path.dirname( path.abspath(__file__) ) ) +sys.path.append(src_dir) + + +import whale_viewer as sw_wv # a menu to pick one of the images title = st.title("Whale Viewer testing") diff --git a/tests/test_demo_wv.py b/tests/test_demo_wv.py index 722c53c..8a3de62 100644 --- a/tests/test_demo_wv.py +++ b/tests/test_demo_wv.py @@ -17,7 +17,7 @@ def test_selectbox_ok(): - finally, we check there are the right number of options (26) ''' - at = AppTest.from_file("src/demo_wv.py").run() + at = AppTest.from_file("src/apptest/demo_wv.py").run() assert len(at.selectbox) == 1 assert at.selectbox[0].value == "beluga" assert at.selectbox[0].index == 0 @@ -62,7 +62,7 @@ def test_img_props(): - then changing the image, we do the same checks again ''' - at = AppTest.from_file("src/demo_wv.py").run() + at = AppTest.from_file("src/apptest/demo_wv.py").run() ix = 0 # we didn't interact with the dropdown, so it should be the first one # could fetch the property - maybe better in case code example changes ix = at.selectbox[0].index