mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-20 18:52:30 +01:00
Todo: 3a5477b9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 lines
608 B
Python
32 lines
608 B
Python
"""A real Tk root per test. Run under xvfb-run, never on kuhy's display."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tkinter as tk
|
|
from collections.abc import Iterator
|
|
|
|
import pytest
|
|
|
|
|
|
@pytest.fixture
|
|
def root() -> Iterator[tk.Tk]:
|
|
win = tk.Tk()
|
|
win.geometry("480x320+0+0")
|
|
yield win
|
|
win.destroy()
|
|
|
|
|
|
class Opener:
|
|
"""Stands in for the browser launch: records URLs, opens nothing."""
|
|
|
|
def __init__(self) -> None:
|
|
self.urls: list[str] = []
|
|
|
|
def __call__(self, url: str) -> None:
|
|
self.urls.append(url)
|
|
|
|
|
|
@pytest.fixture
|
|
def opener() -> Opener:
|
|
return Opener()
|