-
Notifications
You must be signed in to change notification settings - Fork 0
[codex] Fix main CI regressions in GUI import fallbacks and docs build #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,10 @@ | |||||
| from __future__ import annotations | ||||||
|
|
||||||
| import inspect | ||||||
| import json | ||||||
| import math | ||||||
| import subprocess | ||||||
| import sys | ||||||
| import threading | ||||||
| from pathlib import Path | ||||||
| from types import SimpleNamespace | ||||||
|
|
@@ -259,6 +262,51 @@ def test_resolve_initial_dialog_dimensions_keeps_larger_default_size() -> None: | |||||
| assert startup_size == app_module._SETUP_DIALOG_PREFERRED_SIZE | ||||||
|
|
||||||
|
|
||||||
| def test_gui_module_exports_fallback_helpers_when_pyqt6_is_unavailable() -> None: | ||||||
| repo_root = Path(__file__).resolve().parents[2] | ||||||
| script = f""" | ||||||
| import builtins | ||||||
| import importlib | ||||||
| import json | ||||||
| import sys | ||||||
|
|
||||||
| sys.path.insert(0, {str(repo_root / "src")!r}) | ||||||
| original_import = builtins.__import__ | ||||||
|
|
||||||
|
|
||||||
| def _blocked_import(name, globals=None, locals=None, fromlist=(), level=0): | ||||||
| if name == "PyQt6" or name.startswith("PyQt6."): | ||||||
| raise ImportError("blocked for test") | ||||||
| return original_import(name, globals, locals, fromlist, level) | ||||||
|
|
||||||
|
|
||||||
| builtins.__import__ = _blocked_import | ||||||
| module = importlib.import_module("clearex.gui.app") | ||||||
| print( | ||||||
| json.dumps( | ||||||
| {{ | ||||||
| "HAS_PYQT6": module.HAS_PYQT6, | ||||||
| "has_apply_application_icon": hasattr(module, "_apply_application_icon"), | ||||||
| "has_show_startup_splash": hasattr(module, "_show_startup_splash"), | ||||||
| }} | ||||||
| ) | ||||||
| ) | ||||||
| """ | ||||||
| result = subprocess.run( | ||||||
| [sys.executable, "-c", script], | ||||||
|
||||||
| [sys.executable, "-c", script], | |
| [sys.executable, "-c", inspect.cleandoc(script)], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring says the fallback is used "until the PyQt implementation overrides it", but when
HAS_PYQT6isFalsethe override never happens in the same interpreter session. Consider rephrasing to clarify that these are permanent no-ops in non-PyQt environments, and are only shadowed by the PyQt definitions when PyQt6 is importable during module import.