Skip to content

Commit 4609896

Browse files
committed
skip segfaulting tests for python 3.9
Signed-off-by: Eli Uriegas <[email protected]>
1 parent 81d47c3 commit 4609896

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

test/common_utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
import numpy as np
1919
from PIL import Image
2020

21+
IS_PY39 = sys.version_info.major == 3 and sys.version_info.minor == 9
22+
PY39_SEGFAULT_SKIP_MSG = "Segmentation fault with Python 3.9, see https://github.com/pytorch/vision/issues/3367"
23+
PY39_SKIP = unittest.skipIf(IS_PY39, PY39_SEGFAULT_SKIP_MSG)
2124

2225
@contextlib.contextmanager
2326
def get_tmp_dir(src=None, **kwargs):

test/test_video.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import tempfile
55
import unittest
66
import random
7+
import sys
78

89
import itertools
910

@@ -13,6 +14,7 @@
1314
import torch
1415
import torchvision
1516
from torchvision.io import _HAS_VIDEO_OPT, VideoReader
17+
from common_utils import PY39_SKIP
1618

1719
try:
1820
import av
@@ -278,6 +280,7 @@ def _template_read_video(video_object, s=0, e=None):
278280

279281
@unittest.skipIf(_HAS_VIDEO_OPT is False, "Didn't compile with ffmpeg")
280282
class TestVideo(unittest.TestCase):
283+
@PY39_SKIP
281284
@unittest.skipIf(av is None, "PyAV unavailable")
282285
def test_read_video_tensor(self):
283286
"""
@@ -362,6 +365,7 @@ def test_metadata(self):
362365
config.duration, reader_md["video"]["duration"][0], delta=0.5
363366
)
364367

368+
@PY39_SKIP
365369
@unittest.skipIf(av is None, "PyAV unavailable")
366370
def test_video_reading_fn(self):
367371
"""

test/test_video_reader.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import torchvision.io as io
1111
from numpy.random import randint
1212
from torchvision.io import _HAS_VIDEO_OPT
13+
from common_utils import PY39_SKIP
1314

1415

1516
try:
@@ -426,6 +427,7 @@ def test_stress_test_read_video_from_file(self):
426427
audio_timebase_den,
427428
)
428429

430+
@PY39_SKIP
429431
def test_read_video_from_file(self):
430432
"""
431433
Test the case when decoder starts with a video file to decode frames.
@@ -471,6 +473,7 @@ def test_read_video_from_file(self):
471473
# compare decoding results
472474
self.compare_decoding_result(tv_result, pyav_result, config)
473475

476+
@PY39_SKIP
474477
def test_read_video_from_file_read_single_stream_only(self):
475478
"""
476479
Test the case when decoder starts with a video file to decode frames, and
@@ -779,6 +782,7 @@ def test_read_video_from_file_rescale_width_and_height(self):
779782
self.assertEqual(tv_result[0].size(1), height)
780783
self.assertEqual(tv_result[0].size(2), width)
781784

785+
@PY39_SKIP
782786
def test_read_video_from_file_audio_resampling(self):
783787
"""
784788
Test the case when decoder starts with a video file to decode frames, and
@@ -838,6 +842,7 @@ def test_read_video_from_file_audio_resampling(self):
838842
delta=0.1 * asample_rate.item(),
839843
)
840844

845+
@PY39_SKIP
841846
def test_compare_read_video_from_memory_and_file(self):
842847
"""
843848
Test the case when video is already in memory, and decoder reads data in memory
@@ -904,6 +909,7 @@ def test_compare_read_video_from_memory_and_file(self):
904909
# finally, compare results decoded from memory and file
905910
self.compare_decoding_result(tv_result_memory, tv_result_file)
906911

912+
@PY39_SKIP
907913
def test_read_video_from_memory(self):
908914
"""
909915
Test the case when video is already in memory, and decoder reads data in memory
@@ -948,6 +954,7 @@ def test_read_video_from_memory(self):
948954
self.check_separate_decoding_result(tv_result, config)
949955
self.compare_decoding_result(tv_result, pyav_result, config)
950956

957+
@PY39_SKIP
951958
def test_read_video_from_memory_get_pts_only(self):
952959
"""
953960
Test the case when video is already in memory, and decoder reads data in memory.
@@ -1017,6 +1024,7 @@ def test_read_video_from_memory_get_pts_only(self):
10171024
self.assertEqual(tv_result_pts_only[5].numel(), 0)
10181025
self.compare_decoding_result(tv_result, tv_result_pts_only)
10191026

1027+
@PY39_SKIP
10201028
def test_read_video_in_range_from_memory(self):
10211029
"""
10221030
Test the case when video is already in memory, and decoder reads data in memory.
@@ -1192,6 +1200,7 @@ def test_probe_video_from_memory_script(self):
11921200
probe_result = scripted_fun(video_tensor)
11931201
self.check_meta_result(probe_result, config)
11941202

1203+
@PY39_SKIP
11951204
def test_read_video_from_memory_scripted(self):
11961205
"""
11971206
Test the case when video is already in memory, and decoder reads data in memory

0 commit comments

Comments
 (0)