Repository navigation
test(helpers): narrow EGL device probe catch to MissingFunctionException - #3020
Merged
Merged
Conversation
select_headless_egl_device_for_cuda caught `except Exception: return None`, which violates the "Capability probes must not swallow real bugs" rule in cuda_core/tests/AGENTS.md. A real failure (ctypes drift, a pyglet internal rename, a transient EGL error) was swallowed and turned into None, which makes the caller fall back to EGL device 0 -- the broken path on the multi-GPU systems NVIDIA#2865 fixes -- so the test re-failed with the original CUDA_ERROR_INVALID_DEVICE and no sign the fix ran. The only genuine "extension not available" signal is pyglet.gl.lib.MissingFunctionException: link_EGL returns a stub for an unresolvable entry point, and the stub raises it when called. Narrow the catch to that type and let everything else propagate. EGL_FALSE returns are already handled as "no match", and the caller already skips when libEGL is absent, so no ImportError handling is needed. Follow-up to NVIDIA#2865. Refs NVIDIA#2864.
Contributor
4 tasks done
Contributor
Author
|
/ok to test f4fe917 |
juenglin
enabled auto-merge (squash)
October 5, 2026 18:02
Contributor
|
Andy-Jost
approved these changes
Oct 5, 2026
Andy-Jost
added a commit
that referenced
this pull request
Oct 6, 2026
) * test(helpers): keep the EGL device probe from importing pyglet.gl select_headless_egl_device_for_cuda runs before the graphics tests set pyglet.options["headless_device"]. Importing pyglet.gl there creates pyglet's shadow window, which in headless mode opens the EGL display on device 0 and caches it, so the later headless_device assignment has no effect and the GL context lands on EGL device 0 again (#2864). Match MissingFunctionException by module and name instead, as is_gl_context_unavailable already does, and add a subprocess test that asserts the probe leaves pyglet.gl unimported. Follow-up to #3020. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test(graphics): hand the probe child the test-helpers package path CI does not install cuda_python_test_helpers; the parent imports it only through the conftest sys.path fallback, which the -c child does not inherit, so test_egl_device_probe_does_not_import_pyglet_gl failed in every Linux row with ModuleNotFoundError. The child now gets a PYTHONPATH that names the parent directory of the package the parent imported, and a failure reports the child's stderr. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
closes #2864
Follow-up to #2865.
select_headless_egl_device_for_cudaincuda_python_test_helpers/cuda_python_test_helpers/graphics.pyis a capability probe, but it caughtexcept Exception: return None, which violates the "Capability probes must not swallow real bugs" rule incuda_core/tests/AGENTS.md. A real failure (ctypes drift, a pyglet internal rename, a transient EGL error) was swallowed and turned intoNone, which makes_configure_pyglet_headless()leavepyglet.options["headless_device"]unset and fall back to EGL device 0 -- the broken path on the multi-GPU systems #2865 fixes -- so the test would re-fail with the originalCUDA_ERROR_INVALID_DEVICEand no sign the fix ran.The only genuine "extension not available" signal here is
pyglet.gl.lib.MissingFunctionException:link_EGLreturns a stub for an unresolvable entry point (e.g. an EGL stack that haseglQueryDevicesEXTbut noteglQueryDeviceAttribEXT), and the stub raisesMissingFunctionExceptionwhen called. Narrow the catch to that type and let everything else propagate.EGL_FALSEreturns are already handled as "no match", and the caller already skips when libEGL is absent, so noImportErrorhandling is needed.Checklist