Skip to content

Commit 4b8722a

Browse files
committed
Added executng animation while executing cargo command
1 parent d7fdcf5 commit 4b8722a

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

e2etests/run_tests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@
88
import time
99
import platform
1010
import re
11+
import threading
1112
from datetime import datetime
1213
from pathlib import Path
1314

15+
def show_spinner(stop_event):
16+
"""Show rotating spinner animation"""
17+
spinner = ['|', '/', '-', '\\']
18+
i = 0
19+
while not stop_event.is_set():
20+
print(f"\rExecuting... {spinner[i % len(spinner)]}", end="", flush=True)
21+
time.sleep(0.1)
22+
i += 1
23+
1424
def strip_ansi(text):
1525
"""Remove ANSI escape sequences from text"""
1626
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
@@ -121,10 +131,20 @@ def run_single_cargo_test(feature, test_suite, binary_path="q", quiet=False):
121131
print(f"🔄 Running: {feature} with {test_suite}")
122132
print(f"Command: {' '.join(cmd)}")
123133

134+
# Start rotating animation
135+
stop_animation = threading.Event()
136+
animation_thread = threading.Thread(target=show_spinner, args=(stop_animation,))
137+
animation_thread.start()
138+
124139
start_time = time.time()
125140
result = subprocess.run(cmd, capture_output=True, text=True)
126141
end_time = time.time()
127142

143+
# Stop animation
144+
stop_animation.set()
145+
animation_thread.join()
146+
print("\r", end="") # Clear spinner line
147+
128148
# Parse individual test results
129149
individual_tests = parse_test_results(result.stdout)
130150

0 commit comments

Comments
 (0)