diff --git a/.github/scripts/unittest.sh b/.github/scripts/unittest.sh index 7f2b2100389..2d2b15dc840 100755 --- a/.github/scripts/unittest.sh +++ b/.github/scripts/unittest.sh @@ -11,5 +11,6 @@ echo '::group::Install testing utilities' pip install --progress-bar=off pytest pytest-mock pytest-cov expecttest echo '::endgroup::' +export SHOULD_HAVE_VIDEO_EXTENSION=1 python test/smoke_test.py -pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 +#pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 diff --git a/torchvision/io/_video_opt.py b/torchvision/io/_video_opt.py index 2bd7d11929e..90557cfaa17 100644 --- a/torchvision/io/_video_opt.py +++ b/torchvision/io/_video_opt.py @@ -1,4 +1,5 @@ import math +import os import warnings from fractions import Fraction from typing import Dict, List, Optional, Tuple, Union @@ -11,9 +12,12 @@ try: _load_library("video_reader") _HAS_VIDEO_OPT = True -except (ImportError, OSError): +except (ImportError, OSError) as e: _HAS_VIDEO_OPT = False + if "SHOULD_HAVE_VIDEO_EXTENSION" in os.environ: + warnings.warn(f"Failed to load video Python extension: '{e}'") + default_timebase = Fraction(0, 1)