Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
c45f5dc6
Unverified
Commit
c45f5dc6
authored
May 31, 2023
by
Philip Meier
Committed by
GitHub
May 31, 2023
Browse files
only run pyav backend tests for VideoReader if av is available (#7641)
Co-authored-by:
Nicolas Hug
<
nh.nicolas.hug@gmail.com
>
parent
f36c5de4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
test/test_videoapi.py
test/test_videoapi.py
+12
-5
No files found.
test/test_videoapi.py
View file @
c45f5dc6
...
@@ -25,6 +25,13 @@ CheckerConfig = ["duration", "video_fps", "audio_sample_rate"]
...
@@ -25,6 +25,13 @@ CheckerConfig = ["duration", "video_fps", "audio_sample_rate"]
GroundTruth
=
collections
.
namedtuple
(
"GroundTruth"
,
" "
.
join
(
CheckerConfig
))
GroundTruth
=
collections
.
namedtuple
(
"GroundTruth"
,
" "
.
join
(
CheckerConfig
))
def
backends
():
backends_
=
[
"video_reader"
]
if
av
is
not
None
:
backends_
.
append
(
"pyav"
)
return
backends_
def
fate
(
name
,
path
=
"."
):
def
fate
(
name
,
path
=
"."
):
"""Download and return a path to a sample from the FFmpeg test suite.
"""Download and return a path to a sample from the FFmpeg test suite.
See the `FFmpeg Automated Test Environment <https://www.ffmpeg.org/fate.html>`_
See the `FFmpeg Automated Test Environment <https://www.ffmpeg.org/fate.html>`_
...
@@ -53,7 +60,7 @@ test_videos = {
...
@@ -53,7 +60,7 @@ test_videos = {
class
TestVideoApi
:
class
TestVideoApi
:
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"backend"
,
[
"video_reader"
,
"pyav"
]
)
@
pytest
.
mark
.
parametrize
(
"backend"
,
backends
()
)
def
test_frame_reading
(
self
,
test_video
,
backend
):
def
test_frame_reading
(
self
,
test_video
,
backend
):
torchvision
.
set_video_backend
(
backend
)
torchvision
.
set_video_backend
(
backend
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
...
@@ -119,7 +126,7 @@ class TestVideoApi:
...
@@ -119,7 +126,7 @@ class TestVideoApi:
@
pytest
.
mark
.
parametrize
(
"stream"
,
[
"video"
,
"audio"
])
@
pytest
.
mark
.
parametrize
(
"stream"
,
[
"video"
,
"audio"
])
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"backend"
,
[
"video_reader"
,
"pyav"
]
)
@
pytest
.
mark
.
parametrize
(
"backend"
,
backends
()
)
def
test_frame_reading_mem_vs_file
(
self
,
test_video
,
stream
,
backend
):
def
test_frame_reading_mem_vs_file
(
self
,
test_video
,
stream
,
backend
):
torchvision
.
set_video_backend
(
backend
)
torchvision
.
set_video_backend
(
backend
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
...
@@ -166,7 +173,7 @@ class TestVideoApi:
...
@@ -166,7 +173,7 @@ class TestVideoApi:
del
reader
,
reader_md
del
reader
,
reader_md
@
pytest
.
mark
.
parametrize
(
"test_video,config"
,
test_videos
.
items
())
@
pytest
.
mark
.
parametrize
(
"test_video,config"
,
test_videos
.
items
())
@
pytest
.
mark
.
parametrize
(
"backend"
,
[
"video_reader"
,
"pyav"
]
)
@
pytest
.
mark
.
parametrize
(
"backend"
,
backends
()
)
def
test_metadata
(
self
,
test_video
,
config
,
backend
):
def
test_metadata
(
self
,
test_video
,
config
,
backend
):
"""
"""
Test that the metadata returned via pyav corresponds to the one returned
Test that the metadata returned via pyav corresponds to the one returned
...
@@ -180,7 +187,7 @@ class TestVideoApi:
...
@@ -180,7 +187,7 @@ class TestVideoApi:
assert
config
.
duration
==
approx
(
reader_md
[
"video"
][
"duration"
][
0
],
abs
=
0.5
)
assert
config
.
duration
==
approx
(
reader_md
[
"video"
][
"duration"
][
0
],
abs
=
0.5
)
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"test_video"
,
test_videos
.
keys
())
@
pytest
.
mark
.
parametrize
(
"backend"
,
[
"video_reader"
,
"pyav"
]
)
@
pytest
.
mark
.
parametrize
(
"backend"
,
backends
()
)
def
test_seek_start
(
self
,
test_video
,
backend
):
def
test_seek_start
(
self
,
test_video
,
backend
):
torchvision
.
set_video_backend
(
backend
)
torchvision
.
set_video_backend
(
backend
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
...
@@ -249,7 +256,7 @@ class TestVideoApi:
...
@@ -249,7 +256,7 @@ class TestVideoApi:
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
skipif
(
av
is
None
,
reason
=
"PyAV unavailable"
)
@
pytest
.
mark
.
parametrize
(
"test_video,config"
,
test_videos
.
items
())
@
pytest
.
mark
.
parametrize
(
"test_video,config"
,
test_videos
.
items
())
@
pytest
.
mark
.
parametrize
(
"backend"
,
[
"pyav"
,
"video_reader"
]
)
@
pytest
.
mark
.
parametrize
(
"backend"
,
backends
()
)
def
test_keyframe_reading
(
self
,
test_video
,
config
,
backend
):
def
test_keyframe_reading
(
self
,
test_video
,
config
,
backend
):
torchvision
.
set_video_backend
(
backend
)
torchvision
.
set_video_backend
(
backend
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
full_path
=
os
.
path
.
join
(
VIDEO_DIR
,
test_video
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment