Skip to content

Commit e45a834

Browse files
committed
new test for GUI.
1 parent bb21d5c commit e45a834

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_gui.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import subprocess
2+
import sys
3+
import os
4+
5+
def test_main_runs():
6+
"""Check that main.py launches the GUI and exits without errors."""
7+
8+
main_path = os.path.join(os.path.dirname(__file__), "..", "main.py")
9+
assert os.path.exists(main_path), f"main.py not found at {main_path}"
10+
11+
env = os.environ.copy()
12+
env["PYTHONPATH"] = os.path.join(os.path.dirname(__file__), "..")
13+
env["AUTO_CLOSE_GUI"] = "1" # auto-close GUI after 1 second
14+
15+
result = subprocess.run(
16+
[sys.executable, main_path],
17+
capture_output=True,
18+
text=True,
19+
env=env
20+
)
21+
22+
assert result.returncode == 0, f"main.py failed with error:\n{result.stderr}"

0 commit comments

Comments
 (0)