Skip to content

torchhub tests are not run in CI #7398

@pmeier

Description

@pmeier

For example https://app.circleci.com/pipelines/github/pytorch/vision/23876/workflows/d96da5f3-9ca0-4615-9c08-0373c00233a0/jobs/1849866?invite=true#step-105-10

The problem is that we skip in case

@pytest.mark.skipif("torchvision" in sys.modules, reason="TestHub must start without torchvision imported")

but we do that on multiple occasions during collection. The newest examples are

import torchvision
torchvision.disable_beta_transforms_warning()

and implicitly in

from common_utils import CUDA_NOT_AVAILABLE_MSG, IN_FBCODE, IN_OSS_CI, IN_RE_WORKER, OSS_CI_GPU_NO_CUDA_MSG

for example

from torch.testing._comparison import BooleanPair, NonePair, not_close_error_metas, NumberPair, TensorLikePair
from torchvision import datapoints, io
from torchvision.transforms._functional_tensor import _max_value as get_max_value
from torchvision.transforms.v2.functional import convert_dtype_image_tensor, to_image_tensor

This is not new after the v2 port though. It goes all the way back to the combination of #4025 and #4280. The former introduced the import of common_utils in conftest while the latter introduced a torchvision import in common_utils. Meaning, we haven't been running our torchhub tests for roughly 1.5 years now:

https://app.circleci.com/pipelines/github/pytorch/vision/9847/workflows/813b8bbf-7aa4-4a84-b3ab-2b453035c206/jobs/735233?invite=true#step-102-64

We should really not just skip in such cases.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions