43 lines
982 B
Python
43 lines
982 B
Python
|
|
"""Conftest for tray tests — stub rumps so tray/__init__.py can be imported on Linux."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import sys
|
||
|
|
import types
|
||
|
|
|
||
|
|
|
||
|
|
def _stub_rumps() -> None:
|
||
|
|
"""Insert a minimal rumps stub so tray/app.py can be imported without the macOS dep."""
|
||
|
|
if "rumps" in sys.modules:
|
||
|
|
return
|
||
|
|
|
||
|
|
rumps = types.ModuleType("rumps")
|
||
|
|
|
||
|
|
class _App:
|
||
|
|
def __init__(self, *a, **kw): ...
|
||
|
|
def run(self): ...
|
||
|
|
|
||
|
|
class _MenuItem:
|
||
|
|
def __init__(self, *a, **kw): ...
|
||
|
|
|
||
|
|
class _Timer:
|
||
|
|
def __init__(self, *a, **kw): ...
|
||
|
|
def start(self): ...
|
||
|
|
def stop(self): ...
|
||
|
|
|
||
|
|
def notification(*a, **kw): ...
|
||
|
|
def alert(*a, **kw): ...
|
||
|
|
|
||
|
|
rumps.App = _App
|
||
|
|
rumps.MenuItem = _MenuItem
|
||
|
|
rumps.Timer = _Timer
|
||
|
|
rumps.notification = notification
|
||
|
|
rumps.alert = alert
|
||
|
|
rumps.clicked = lambda *a, **kw: (lambda f: f)
|
||
|
|
rumps.timer = lambda *a, **kw: (lambda f: f)
|
||
|
|
|
||
|
|
sys.modules["rumps"] = rumps
|
||
|
|
|
||
|
|
|
||
|
|
_stub_rumps()
|