2024-03-24 22:36:00 +00:00
|
|
|
import sys
|
2024-03-22 18:08:35 +00:00
|
|
|
from collections.abc import Generator
|
|
|
|
from subprocess import Popen
|
2024-03-24 22:36:00 +00:00
|
|
|
from typing import NewType
|
2024-03-22 18:08:35 +00:00
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
|
|
def wayland_compositor() -> Generator[Popen, None, None]:
|
|
|
|
# Start the Wayland compositor (e.g., Weston)
|
2024-03-24 22:36:00 +00:00
|
|
|
# compositor = Popen(["weston", "--backend=headless-backend.so"])
|
|
|
|
compositor = Popen(["weston"])
|
2024-03-22 18:08:35 +00:00
|
|
|
yield compositor
|
|
|
|
# Cleanup: Terminate the compositor
|
|
|
|
compositor.terminate()
|
|
|
|
|
|
|
|
|
2024-03-24 22:36:00 +00:00
|
|
|
GtkProc = NewType("GtkProc", Popen)
|
|
|
|
|
|
|
|
|
2024-03-22 18:08:35 +00:00
|
|
|
@pytest.fixture(scope="function")
|
2024-03-24 22:36:00 +00:00
|
|
|
def app() -> Generator[GtkProc, None, None]:
|
2024-06-05 09:23:12 +00:00
|
|
|
rapp = Popen([sys.executable, "-m", "clan_app"], text=True)
|
2024-03-24 22:36:00 +00:00
|
|
|
yield GtkProc(rapp)
|
2024-03-22 18:08:35 +00:00
|
|
|
# Cleanup: Terminate your application
|
2024-03-24 22:36:00 +00:00
|
|
|
rapp.terminate()
|