Private
Public Access
0
0

chore(commands): remove dead test-fixture path from reset_layout

This commit is contained in:
2026-06-29 16:48:05 -04:00
parent c42a759911
commit 3b96628877
2 changed files with 25 additions and 9 deletions
+4 -9
View File
@@ -355,21 +355,16 @@ def reset_layout(app: "App") -> None:
window names that no longer exist (e.g. after a refactor renames
windows) and the dock space appears empty / non-recoverable via
the Windows menu. Sets every show_windows entry to True and
deletes manualslop_layout.ini so hello_imgui regenerates a fresh
dock layout on the next frame (and the next process shutdown saves
the new layout in place of the stale one). The user will need to
restart sloppy.py for the dock layout to fully take effect; the
show_windows toggles take effect immediately.
deletes the cwd's manualslop_layout.ini so hello_imgui regenerates
a fresh dock layout on the next process restart. The show_windows
toggles take effect immediately.
"""
if hasattr(app, "show_windows") and isinstance(app.show_windows, dict):
for name in app.show_windows.keys():
app.show_windows[name] = True
try:
import os
layout_paths = [
"manualslop_layout.ini",
os.path.join("tests", "artifacts", "live_gui_workspace", "manualslop_layout.ini"),
]
layout_paths: list[str] = ["manualslop_layout.ini"]
for p in layout_paths:
if os.path.exists(p):
os.remove(p)
+21
View File
@@ -0,0 +1,21 @@
from __future__ import annotations
import ast
import inspect
import src.commands as commands
def test_reset_layout_excludes_test_fixture_path() -> None:
source: str = inspect.getsource(commands.reset_layout)
assert "tests/artifacts/live_gui_workspace" not in source
assert "os.path.join" not in source
assert "manualslop_layout.ini" in source
def test_reset_layout_runs_on_clean_app() -> None:
class _MockApp:
pass
mock_app: _MockApp = _MockApp()
mock_app.show_windows = {}
commands.reset_layout(mock_app)