Skip to content

Conversation

@mdboom
Copy link
Contributor

@mdboom mdboom commented Oct 10, 2025

These inadvertently got commented out in #914.

@copy-pr-bot
Copy link
Contributor

copy-pr-bot bot commented Oct 10, 2025

Auto-sync is disabled for ready for review pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@mdboom mdboom added the to-be-backported Trigger the bot to raise a backport PR upon merge label Oct 10, 2025
@mdboom mdboom self-assigned this Oct 10, 2025
@mdboom mdboom requested a review from leofang October 10, 2025 14:57
@mdboom mdboom added the P0 High priority - Must do! label Oct 10, 2025
@mdboom
Copy link
Contributor Author

mdboom commented Oct 10, 2025

/ok to test

@github-actions

This comment has been minimized.

@mdboom
Copy link
Contributor Author

mdboom commented Oct 10, 2025

/ok to test

leofang
leofang previously approved these changes Oct 10, 2025
@leofang leofang added the cuda.bindings Everything related to the cuda.bindings module label Oct 10, 2025
@leofang leofang added this to the cuda-python 13-next, 12-next milestone Oct 10, 2025

@pytest.mark.skipif(PySide6 is None, reason="PySide6 not installed")
def test_graphics_api_smoketest():
from PySide6 import QtGui, QtOpenGL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we can avoid a bunch of the noisy skipif and imports by using importorskip here:

Suggested change
from PySide6 import QtGui, QtOpenGL
PySide6 = pytest.importorskip("PySide6")
QtGui = PySide6.QtGui
QtOpenGL = PySide6.QtOpenGL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about the importorskip trick.

Still need to import the subpackages explicitly, though. PySide6 doesn't import everything automatically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can pass a dotted path to importorskip, making this code even shorter:

QtGui = pytest.importorksip("PySide6.QtGui")
# etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't realize they were subpackages, otherwise I would've made that my original suggestion!

Co-authored-by: Leo Fang <leo80042@gmail.com>
@mdboom
Copy link
Contributor Author

mdboom commented Oct 10, 2025

/ok to test

@mdboom mdboom requested a review from cpcloud October 10, 2025 19:38
cpcloud
cpcloud previously approved these changes Oct 10, 2025
Copy link
Contributor

@cpcloud cpcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional skip can be done later if desired.



def test_graphics_api_smoketest():
_ = pytest.importorskip("PySide6")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love skippable tests because I feel too much complexity is introduced from the lack of symmetry between local and ci builds. For example, there is a potential for the tests to bit-rot if they aren't run frequently enough by devs or the ci runners.

@mdboom
Copy link
Contributor Author

mdboom commented Oct 13, 2025

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Oct 13, 2025

/ok to test

@mdboom
Copy link
Contributor Author

mdboom commented Oct 13, 2025

I have updated this to use the pyglet-based test as suggested by @pijyoi (and pyglet is small enough, I think it's fine to add a a test-only dependency) and added a the "always expected to fail" test as suggested by @rparolin. I think this is ready to go.

@mdboom
Copy link
Contributor Author

mdboom commented Oct 13, 2025

/ok to test

@leofang leofang linked an issue Oct 13, 2025 that may be closed by this pull request
1 task
@leofang leofang merged commit 73da391 into NVIDIA:main Oct 13, 2025
71 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 13, 2025
* Fix #1122: Reinstate graphics APIs

* Add a test

* Update cuda_bindings/tests/test_graphics_apis.py

Co-authored-by: Leo Fang <leo80042@gmail.com>

* Use importorskip

* Improve tests

* Fix test

* Fix Windows tests

---------

Co-authored-by: Leo Fang <leo80042@gmail.com>
(cherry picked from commit 73da391)
@github-actions
Copy link

Successfully created backport PR for 12.9.x:

@github-actions
Copy link

Doc Preview CI
Preview removed because the pull request was closed or merged.

leofang added a commit that referenced this pull request Oct 14, 2025
* Fix #1122: Reinstate graphics APIs (#1123)

* Fix #1122: Reinstate graphics APIs

* Add a test

* Update cuda_bindings/tests/test_graphics_apis.py

Co-authored-by: Leo Fang <leo80042@gmail.com>

* Use importorskip

* Improve tests

* Fix test

* Fix Windows tests

---------

Co-authored-by: Leo Fang <leo80042@gmail.com>
(cherry picked from commit 73da391)

* [pre-commit.ci] auto code formatting

---------

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
Co-authored-by: Leo Fang <leo80042@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.bindings Everything related to the cuda.bindings module P0 High priority - Must do! to-be-backported Trigger the bot to raise a backport PR upon merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: cudaGraphicsGLRegisterImage returns null handle with cuda-bindings 12.9.3

4 participants