-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_qprocess_changes.py
More file actions
50 lines (37 loc) · 1.44 KB
/
test_qprocess_changes.py
File metadata and controls
50 lines (37 loc) · 1.44 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""
Test script to verify QProcess changes work correctly.
This script tests that the converted functions can be called without blocking.
"""
import sys
from PyQt6.QtWidgets import QApplication
from PyQt6.QtCore import QTimer
# Import the modified functions
from src.app.system_utils import apply_tdp_settings
from src.app.main_window import MainWindow
def test_tdp_settings():
"""Test that apply_tdp_settings doesn't block"""
print("Testing TDP settings with QProcess...")
test_profile = {
"fast-limit": 25,
"slow-limit": 15,
}
def callback(success, message):
print(f"TDP Settings callback: success={success}, message={message}")
# Exit after 2 seconds to allow process to complete
QTimer.singleShot(2000, app.quit)
# This should return None immediately and not block
result = apply_tdp_settings(test_profile, callback)
print(f"apply_tdp_settings returned: {result} (should be None for async)")
print("✓ Function returned immediately without blocking!")
if __name__ == "__main__":
print("=" * 60)
print("Testing QProcess Non-Blocking Behavior")
print("=" * 60)
app = QApplication(sys.argv)
# Test TDP settings
test_tdp_settings()
print("\nIf the UI is responsive and you can see this message,")
print("the QProcess conversion is working correctly!")
print("\nWaiting for process to complete...")
sys.exit(app.exec())