Skip to content

Commit 9f521ff

Browse files
committed
Made app module internal. Added unit test for app
1 parent e767f40 commit 9f521ff

3 files changed

Lines changed: 33 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ dev = [
4747
"pandas",
4848
"scikit-learn<1.6.0",
4949
"pytest",
50+
"pytest-asyncio",
5051
"black[jupyter]",
5152
"isort",
5253
"flake8",
@@ -60,7 +61,7 @@ app = [
6061
]
6162

6263
[project.scripts]
63-
tda-mapper-app = "tdamapper.app:main"
64+
tda-mapper-app = "tdamapper._app:main"
6465

6566
[project.urls]
6667
Homepage = "https://github.com/lucasimi/tda-mapper-python"
@@ -97,3 +98,15 @@ include_trailing_comma = true
9798
force_grid_wrap = 0
9899
combine_as_imports = true
99100
skip = ["venv", ".venv", "build", "dist"]
101+
102+
[tool.pytest.ini_options]
103+
asyncio_mode = "auto"
104+
testpaths = ["tests"]
105+
asyncio_default_fixture_loop_scope = "function"
106+
filterwarnings = [
107+
'ignore::DeprecationWarning:_plotly_utils\.basevalidators',
108+
]
109+
110+
markers = [
111+
"module_under_test",
112+
]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,5 +603,5 @@ def main():
603603
)
604604

605605

606-
if __name__ in ["__main__", "__mp_main__", "tdamapper.app"]:
606+
if __name__ in ["__main__", "__mp_main__"]:
607607
main()

tests/test_unit_app.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
from nicegui import ui
3+
from nicegui.testing import User
4+
5+
from tdamapper import _app
6+
7+
pytest_plugins = ["nicegui.testing.user_plugin"]
8+
9+
10+
@pytest.mark.module_under_test(_app)
11+
async def test_run_mapper(user: User) -> None:
12+
await user.open("/")
13+
await user.should_see("Load Data")
14+
await user.should_see("Run Mapper")
15+
user.find("Load Data").click()
16+
await user.should_see("File loaded successfully")
17+
user.find("Run Mapper").click()
18+
await user.should_see("Running Mapper...")

0 commit comments

Comments
 (0)