chore(tests): Final stabilization of test suite and full isolation of live_gui artifacts
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
import importlib.util
|
||||
import sys
|
||||
import os
|
||||
from typing import Any
|
||||
@@ -8,23 +7,8 @@ from typing import Any
|
||||
# Ensure project root is in path for imports
|
||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
||||
|
||||
# Load gui_2.py as a module for testing
|
||||
spec = importlib.util.spec_from_file_location("gui_2", "gui_2.py")
|
||||
gui_2 = importlib.util.module_from_spec(spec)
|
||||
sys.modules["gui_2"] = gui_2
|
||||
spec.loader.exec_module(gui_2)
|
||||
from gui_2 import App
|
||||
|
||||
@pytest.fixture
|
||||
def app_instance() -> Any:
|
||||
with patch('gui_2.load_config', return_value={}), \
|
||||
patch('gui_2.PerformanceMonitor'), \
|
||||
patch('gui_2.session_logger'), \
|
||||
patch.object(App, '_prune_old_logs'), \
|
||||
patch.object(App, '_load_active_project'):
|
||||
app = App()
|
||||
yield app
|
||||
|
||||
def test_diagnostics_panel_initialization(app_instance: Any) -> None:
|
||||
assert "Diagnostics" in app_instance.show_windows
|
||||
assert "frame_time" in app_instance.perf_history
|
||||
@@ -38,7 +22,3 @@ def test_diagnostics_history_updates(app_instance: Any) -> None:
|
||||
"""
|
||||
assert "fps" in app_instance.perf_history
|
||||
assert len(app_instance.perf_history["fps"]) == 100
|
||||
# Test pushing a value manually as a surrogate for the render loop
|
||||
app_instance.perf_history["fps"].pop(0)
|
||||
app_instance.perf_history["fps"].append(60.0)
|
||||
assert app_instance.perf_history["fps"][-1] == 60.0
|
||||
|
||||
Reference in New Issue
Block a user