Iproved logging for startup flags.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import inspect
|
||||
import os
|
||||
from argparse import Namespace
|
||||
from configparser import ConfigParser
|
||||
|
||||
from fenrirscreenreader.core import applicationManager
|
||||
@@ -67,6 +68,15 @@ class SettingsManager:
|
||||
def shutdown(self):
|
||||
pass
|
||||
|
||||
def format_cli_args(self, cliArgs):
|
||||
if cliArgs is None:
|
||||
return "{}"
|
||||
if isinstance(cliArgs, Namespace):
|
||||
args = vars(cliArgs)
|
||||
else:
|
||||
args = vars(cliArgs) if hasattr(cliArgs, "__dict__") else {}
|
||||
return str({key: args[key] for key in sorted(args)})
|
||||
|
||||
def get_binding_backup(self):
|
||||
return self.bindingsBackup.copy()
|
||||
|
||||
@@ -644,6 +654,11 @@ class SettingsManager:
|
||||
)
|
||||
)
|
||||
environment["runtime"]["DebugManager"].initialize(environment)
|
||||
environment["runtime"]["DebugManager"].write_debug_out(
|
||||
"Fenrir startup CLI arguments: " + self.format_cli_args(cliArgs),
|
||||
debug.DebugLevel.INFO,
|
||||
on_any_level=True,
|
||||
)
|
||||
|
||||
if cliArgs.force_all_screens:
|
||||
environment["runtime"]["force_all_screens"] = True
|
||||
|
||||
@@ -5,4 +5,4 @@
|
||||
# By Chrys, Storm Dragon, and contributors.
|
||||
|
||||
version = "2026.05.29"
|
||||
code_name = "master"
|
||||
code_name = "testing"
|
||||
|
||||
@@ -5,6 +5,8 @@ Tests the _validate_setting_value method to ensure proper input validation
|
||||
for all configurable settings that could cause crashes or accessibility issues.
|
||||
"""
|
||||
|
||||
from argparse import Namespace
|
||||
|
||||
import pytest
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -206,6 +208,30 @@ def test_focus_settings_define_tui_toggle():
|
||||
assert settings_data["focus"]["tui"] is False
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.settings
|
||||
def test_format_cli_args_reports_startup_flags_in_stable_order():
|
||||
manager = SettingsManager()
|
||||
cli_args = Namespace(
|
||||
debug=True,
|
||||
foreground=False,
|
||||
force_all_screens=False,
|
||||
ignore_screen=["7"],
|
||||
options="speech#rate=1.2",
|
||||
print=False,
|
||||
setting="/tmp/settings.conf",
|
||||
x11=True,
|
||||
x11_window_id="0x123",
|
||||
)
|
||||
|
||||
assert manager.format_cli_args(cli_args) == (
|
||||
"{'debug': True, 'force_all_screens': False, 'foreground': False, "
|
||||
"'ignore_screen': ['7'], 'options': 'speech#rate=1.2', "
|
||||
"'print': False, 'setting': '/tmp/settings.conf', 'x11': True, "
|
||||
"'x11_window_id': '0x123'}"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
@pytest.mark.settings
|
||||
class TestSettingsPathSelection:
|
||||
|
||||
Reference in New Issue
Block a user