Add experimental OpenPGP HKPS pytest compliance suite#4711
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| def _load_asgi_app(import_paths: Iterable[str]) -> Optional[object]: | ||
| for import_path in import_paths: | ||
| try: | ||
| module_name, attribute = import_path.split(":", 1) | ||
| except ValueError: | ||
| continue | ||
| try: | ||
| module = import_module(module_name) | ||
| target = getattr(module, attribute) | ||
| except Exception: | ||
| continue | ||
| app = target() if callable(target) else target | ||
| if app is not None: | ||
| return app |
There was a problem hiding this comment.
Avoid invoking ASGI app objects as factories
The loader treats every imported target as a factory and calls it when callable(target) is true. Real ASGI applications (e.g., FastAPI/Starlette instances) are themselves callable and require (scope, receive, send) parameters, so calling them with no arguments raises TypeError and prevents the plugin from resolving the in-process server even though the path points to a valid app. This makes the default candidates such as hpks.app:app unusable and causes all tests to error instead of running. Only call objects that are zero‑arg factories (or inspect their signature) and return callable apps directly.
Useful? React with 👍 / 👎.
…objects-as-factories/2025-10-13 Fix ASGI app loader for pytest plugin
93c3606 to
99fdb63
Compare
99c5e35 to
0f89d2e
Compare
Summary
openpgp_hkps_pytestpackage with a pytest plugin and fixtures for HKP/HKPS interoperability checksTesting
uv run --directory experimental/openpgp_hkps_pytest --package openpgp_hkps_pytest ruff format .uv run --directory experimental/openpgp_hkps_pytest --package openpgp_hkps_pytest ruff check . --fixhttps://chatgpt.com/codex/tasks/task_e_68ecac9c67fc8326b8f0775dc9fc13e5