-
-
Notifications
You must be signed in to change notification settings - Fork 46
Add experimental OpenPGP HKPS pytest compliance suite #4711
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
base: mono/dev
Are you sure you want to change the base?
Add experimental OpenPGP HKPS pytest compliance suite #4711
Conversation
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.
💡 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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