import importlib.util from pathlib import Path from unittest.mock import Mock import pytest COMMAND_PATH = ( Path(__file__).resolve().parents[2] / "fenrirscreenreader" / "commands" / "commands" / "toggle_vmenu_mode.py" ) def load_command(): spec = importlib.util.spec_from_file_location( "fenrir_toggle_vmenu_mode", COMMAND_PATH ) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module.command() @pytest.mark.unit def test_get_description_does_not_toggle_vmenu_mode(): vmenu_manager = Mock() command = load_command() command.initialize({"runtime": {"VmenuManager": vmenu_manager}}) assert command.get_description() == "Entering or Leaving v menu mode." vmenu_manager.toggle_vmenu_mode.assert_not_called()