import sys import types from clipwright import layouts from clipwright.layouts import layout_picker from clipwright.layouts.layout_picker import _module_flags, apply, pick # Decision labels are bare layout names; the modules they switch on live in the # ``clipwright.layouts`` package and are imported lazily by apply(). _FAKE_LAYOUT_MODULES = { "split_layout": "clipwright.layouts.split_layout", "screencast_layout": "clipwright.layouts.screencast_layout", "active_speaker": "clipwright.layouts.active_speaker", } def fake_modules(monkeypatch, **initial): """Install stand-in layout modules so apply() can be tested without them.""" made = {} for label, dotted in _FAKE_LAYOUT_MODULES.items(): module = types.ModuleType(dotted) module.ENABLED = initial.get(label, False) monkeypatch.setitem(sys.modules, dotted, module) # apply() does ``from clipwright.layouts import