import tomllib from pathlib import Path def test_gui_dependency_is_optional_for_dev_installs(): data = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8")) project = data["project"] dependencies = project.get("dependencies", []) optional = project.get("optional-dependencies", {}) assert all(not dep.startswith("PyGObject") for dep in dependencies) assert any(dep.startswith("PyGObject") for dep in optional["gui"]) assert any(dep.startswith("pytest") for dep in optional["dev"])