-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_full_app.py
More file actions
36 lines (32 loc) · 1.04 KB
/
test_full_app.py
File metadata and controls
36 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import subprocess
import time
import signal
import sys
print("Starting xMLTree.py in subprocess...")
proc = subprocess.Popen([sys.executable, "src/xMLTree.py"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True)
# Wait a few seconds for app to start
time.sleep(3)
# Check if process is still running
if proc.poll() is None:
print("Application started successfully (process still running)")
# Send SIGTERM to terminate
proc.terminate()
try:
stdout, stderr = proc.communicate(timeout=2)
print("Stdout:", stdout[:500])
print("Stderr:", stderr[:500])
except subprocess.TimeoutExpired:
proc.kill()
stdout, stderr = proc.communicate()
print("Process killed after timeout")
else:
# Process exited early
stdout, stderr = proc.communicate()
print("Process exited with code:", proc.returncode)
print("Stdout:", stdout)
print("Stderr:", stderr)
sys.exit(1)
print("Test completed successfully")