Skip to content

Conversation

@zy1git
Copy link
Contributor

@zy1git zy1git commented Dec 8, 2025

Mark CV-CUDA tests with needs_cuda by:
marks=( pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"), pytest.mark.needs_cuda, ),

@pytorch-bot
Copy link

pytorch-bot bot commented Dec 8, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/9305

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 8a2c4c7 with merge base 96e7797 (image):

BROKEN TRUNK - The following jobs failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla bot added the cla signed label Dec 8, 2025
Comment on lines +1245 to +1248
marks=(
pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"),
pytest.mark.needs_cuda,
),
Copy link
Member

Choose a reason for hiding this comment

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

We'll need to use these two marks on every single CV-CUDA test, so instead of duplicating this everywhere, let's simply define a global mark on top of the file as

CV_CUDA_TEST = (
                    pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="CVCUDA is not available"),
                    pytest.mark.needs_cuda,
 )

and then use marks=CV_CUDA_TEST for all of these.

Let's also update the previous test classes from @AntoineSimoulin:

@pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="test requires CVCUDA")
@needs_cuda
class TestCVDUDAToTensor:

and

@pytest.mark.skipif(not CVCUDA_AVAILABLE, reason="test requires CVCUDA")
@needs_cuda
class TestToCVCUDATensor:

to use this mark as well.

I suspect we might be able to also remove the CVCUDA_AVAILABLE global variable now (not sure).

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can create a @needs_cvcuda decorator (similar to @needs_cuda)? We will also have to modify the pytest_configure function to add this decorator. This way we can identify easily tests requiring cvcuda?

Choose a reason for hiding this comment

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

This significantly reduces the boilerplate!

I have gone ahead and updated the branch implementing CV-CUDA for the ToDtype transform and I will preemptively update the others as well.

As a note, I defined CV_CUDA_TEST as a list so we can use it with the pytestmark class attribute for TestCVCUDAToTensor and TestToCVCUDATensor. Example here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants