Skip to content
Snippets Groups Projects
Commit 7eb098d2 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Simplify test organization

parent 00f6a482
No related branches found
No related tags found
No related merge requests found
File moved
File moved
File moved
File moved
......@@ -25,7 +25,7 @@ import numpy
# internal
from .. import utils, create_directories_save
from .. import save as save_to_file
from ..test import utils as test_utils
from .. import test_utils
def list_codecs(*args, **kwargs):
......
......@@ -14,18 +14,17 @@ import sys
import numpy
import nose.tools
from .. import load, write, peek, peek_all, File
from . import utils as testutils
from . import load, write, peek, peek_all, File, test_utils
def test_peek():
f = testutils.datafile('test1.hdf5', __name__)
f = test_utils.datafile('test1.hdf5', __name__)
assert peek(f) == (numpy.uint16, (3,), (1,))
assert peek_all(f) == (numpy.uint16, (3,3), (3,1))
def test_iteration():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
nose.tools.eq_(len(f), 512)
......@@ -35,8 +34,8 @@ def test_iteration():
assert numpy.allclose(l, i)
def test_indexing():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
nose.tools.eq_(len(f), 512)
......@@ -51,7 +50,7 @@ def test_indexing():
def test_slicing_empty():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
objs = f[1:1]
......@@ -59,7 +58,7 @@ def test_slicing_empty():
def test_slicing_0():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
objs = f[:]
......@@ -68,7 +67,7 @@ def test_slicing_0():
def test_slicing_1():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
# get slice
......@@ -81,7 +80,7 @@ def test_slicing_1():
def test_slicing_2():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
# get negative slicing
......@@ -93,7 +92,7 @@ def test_slicing_2():
def test_slicing_3():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
# get negative stepping slice
......@@ -106,7 +105,7 @@ def test_slicing_3():
def test_slicing_4():
fname = testutils.datafile('matlab_2d.hdf5', __name__)
fname = test_utils.datafile('matlab_2d.hdf5', __name__)
f = File(fname, 'r')
# get all negative slice
......@@ -119,28 +118,28 @@ def test_slicing_4():
@nose.tools.raises(TypeError)
def test_indexing_type_check():
f = File(testutils.datafile('matlab_2d.hdf5', __name__), 'r')
f = File(test_utils.datafile('matlab_2d.hdf5', __name__), 'r')
nose.tools.eq_(len(f), 512)
f[4.5]
@nose.tools.raises(IndexError)
def test_indexing_boundaries():
f = File(testutils.datafile('matlab_2d.hdf5', __name__), 'r')
f = File(test_utils.datafile('matlab_2d.hdf5', __name__), 'r')
nose.tools.eq_(len(f), 512)
f[512]
@nose.tools.raises(IndexError)
def test_indexing_negative_boundaries():
f = File(testutils.datafile('matlab_2d.hdf5', __name__), 'r')
f = File(test_utils.datafile('matlab_2d.hdf5', __name__), 'r')
nose.tools.eq_(len(f), 512)
f[-513]
def transcode(filename):
"""Runs a complete transcoding test, to and from the binary format."""
tmpname = testutils.temporary_filename(suffix=os.path.splitext(filename)[1])
tmpname = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1])
try:
# transcode from test format into the test format -- test array access modes
......@@ -171,7 +170,7 @@ def transcode(filename):
def array_readwrite(extension, arr, close=False):
"""Runs a read/write verify step using the given numpy data"""
tmpname = testutils.temporary_filename(suffix=extension)
tmpname = test_utils.temporary_filename(suffix=extension)
try:
write(arr, tmpname)
reloaded = load(tmpname)
......@@ -182,7 +181,7 @@ def array_readwrite(extension, arr, close=False):
def arrayset_readwrite(extension, arrays, close=False):
"""Runs a read/write verify step using the given numpy data"""
tmpname = testutils.temporary_filename(suffix=extension)
tmpname = test_utils.temporary_filename(suffix=extension)
try:
f = File(tmpname, 'w')
for k in arrays:
......@@ -227,11 +226,11 @@ def test_hdf5():
arrayset_readwrite(".h5", a4)
# complete transcoding tests
transcode(testutils.datafile('test1.hdf5', __name__))
transcode(testutils.datafile('matlab_1d.hdf5', __name__))
transcode(testutils.datafile('matlab_2d.hdf5', __name__))
transcode(test_utils.datafile('test1.hdf5', __name__))
transcode(test_utils.datafile('matlab_1d.hdf5', __name__))
transcode(test_utils.datafile('matlab_2d.hdf5', __name__))
@testutils.extension_available('.bindata')
@test_utils.extension_available('.bindata')
def test_torch3_binary():
# array writing tests
......@@ -262,9 +261,9 @@ def test_torch3_binary():
nose.tools.assert_raises(RuntimeError, arrayset_readwrite, ".bindata", a4)
# complete transcoding test
transcode(testutils.datafile('torch3.bindata', __name__))
transcode(test_utils.datafile('torch3.bindata', __name__))
@testutils.extension_available('.mat')
@test_utils.extension_available('.mat')
def test_mat_file_io():
# array writing tests
......@@ -295,23 +294,23 @@ def test_mat_file_io():
arrayset_readwrite(".mat", a4)
# complete transcoding tests
transcode(testutils.datafile('test_1d.mat', __name__)) #pseudo 1D - matlab does not support true 1D
transcode(testutils.datafile('test_2d.mat', __name__))
transcode(testutils.datafile('test_3d.mat', __name__))
transcode(testutils.datafile('test_4d.mat', __name__))
transcode(testutils.datafile('test_1d_cplx.mat', __name__)) #pseudo 1D - matlab does not support 1D
transcode(testutils.datafile('test_2d_cplx.mat', __name__))
transcode(testutils.datafile('test_3d_cplx.mat', __name__))
transcode(testutils.datafile('test_4d_cplx.mat', __name__))
transcode(testutils.datafile('test.mat', __name__)) #3D complex, large
transcode(test_utils.datafile('test_1d.mat', __name__)) #pseudo 1D - matlab does not support true 1D
transcode(test_utils.datafile('test_2d.mat', __name__))
transcode(test_utils.datafile('test_3d.mat', __name__))
transcode(test_utils.datafile('test_4d.mat', __name__))
transcode(test_utils.datafile('test_1d_cplx.mat', __name__)) #pseudo 1D - matlab does not support 1D
transcode(test_utils.datafile('test_2d_cplx.mat', __name__))
transcode(test_utils.datafile('test_3d_cplx.mat', __name__))
transcode(test_utils.datafile('test_4d_cplx.mat', __name__))
transcode(test_utils.datafile('test.mat', __name__)) #3D complex, large
@nose.tools.nottest
@testutils.extension_available('.mat')
@test_utils.extension_available('.mat')
def test_mat_file_io_does_not_crash():
data = load(testutils.datafile('test_cell.mat', __name__))
data = load(test_utils.datafile('test_cell.mat', __name__))
@testutils.extension_available('.tensor')
@test_utils.extension_available('.tensor')
def test_tensorfile():
# array writing tests
......@@ -337,16 +336,16 @@ def test_tensorfile():
arrayset_readwrite(".tensor", a3)
# complete transcoding test
transcode(testutils.datafile('torch.tensor', __name__))
transcode(test_utils.datafile('torch.tensor', __name__))
@testutils.extension_available('.pgm')
@testutils.extension_available('.pbm')
@testutils.extension_available('.ppm')
@test_utils.extension_available('.pgm')
@test_utils.extension_available('.pbm')
@test_utils.extension_available('.ppm')
def test_netpbm():
def image_transcode(filename):
tmpname = testutils.temporary_filename(suffix=os.path.splitext(filename)[1])
tmpname = test_utils.temporary_filename(suffix=os.path.splitext(filename)[1])
try:
# complete transcoding test
......@@ -363,12 +362,12 @@ def test_netpbm():
finally:
if os.path.exists(tmpname): os.unlink(tmpname)
image_transcode(testutils.datafile('test.pgm', __name__)) #indexed, works fine
image_transcode(testutils.datafile('test.pbm', __name__)) #indexed, works fine
image_transcode(testutils.datafile('test.ppm', __name__)) #indexed, works fine
#image_transcode(testutils.datafile('test.jpg', __name__)) #does not work because of re-compression
image_transcode(test_utils.datafile('test.pgm', __name__)) #indexed, works fine
image_transcode(test_utils.datafile('test.pbm', __name__)) #indexed, works fine
image_transcode(test_utils.datafile('test.ppm', __name__)) #indexed, works fine
#image_transcode(test_utils.datafile('test.jpg', __name__)) #does not work because of re-compression
@testutils.extension_available('.csv')
@test_utils.extension_available('.csv')
def test_csv():
# array writing tests
......
......@@ -26,8 +26,7 @@ import numpy
import random
import nose.tools
from .. import HDF5File, load, save, peek_all
from . import utils as testutils
from . import HDF5File, load, save, peek_all, test_utils
def read_write_check(outfile, dname, data, dtype=None):
"""Tests scalar input/output on HDF5 files"""
......@@ -93,7 +92,7 @@ def test_can_create():
# Now we create a new binary output file in a temporary location and save
# the data there.
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
outfile.append('testdata', arrays)
......@@ -147,7 +146,7 @@ def test_type_support():
N = 100
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
data = [bool(int(random.uniform(0,2))) for z in range(N)]
......@@ -215,7 +214,7 @@ def test_dataset_management():
# Let's just create some dummy data to play with
N = 100
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
data = [int(random.uniform(0,N)) for z in range(N)]
......@@ -258,7 +257,7 @@ def test_resize_and_preserve():
array = numpy.array(data, 'int32').reshape(SHAPE)
# Try to save a slice
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
save(array[:,0], tmpname)
finally:
......@@ -269,42 +268,42 @@ def test_can_load_hdf5_from_matlab():
# shows we can load a 2D matlab array and interpret it as a bunch of 1D
# arrays, correctly
t = load(testutils.datafile('matlab_1d.hdf5', __name__))
t = load(test_utils.datafile('matlab_1d.hdf5', __name__))
nose.tools.eq_(t.shape, (512,))
nose.tools.eq_(t.dtype, numpy.float64)
t = load(testutils.datafile('matlab_2d.hdf5', __name__))
t = load(test_utils.datafile('matlab_2d.hdf5', __name__))
nose.tools.eq_(t.shape, (512, 2))
nose.tools.eq_(t.dtype, numpy.float64)
# interestingly enough, if you load those files as arrays, you will read
# the whole data at once:
dtype, shape, stride = peek_all(testutils.datafile('matlab_1d.hdf5', __name__))
dtype, shape, stride = peek_all(test_utils.datafile('matlab_1d.hdf5', __name__))
nose.tools.eq_(shape, (512,))
nose.tools.eq_(dtype, numpy.dtype('float64'))
dtype, shape, stride = peek_all(testutils.datafile('matlab_2d.hdf5', __name__))
dtype, shape, stride = peek_all(test_utils.datafile('matlab_2d.hdf5', __name__))
nose.tools.eq_(shape, (512, 2))
nose.tools.eq_(dtype, numpy.dtype('float64'))
def test_matlab_import():
# This test verifies we can import HDF5 datasets generated in Matlab
mfile = HDF5File(testutils.datafile('matlab_1d.hdf5', __name__))
mfile = HDF5File(test_utils.datafile('matlab_1d.hdf5', __name__))
nose.tools.eq_(mfile.paths(), ('/array',))
def test_ioload_unlimited():
# This test verifies that a 3D array whose first dimension is unlimited
# and size equal to 1 can be read as a 2D array
mfile = load(testutils.datafile('test7_unlimited.hdf5', __name__))
mfile = load(test_utils.datafile('test7_unlimited.hdf5', __name__))
nose.tools.eq_(mfile.ndim, 2)
def test_attribute_version():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
outfile.set_attribute('version', 32)
nose.tools.eq_(outfile.get_attribute('version'), 32)
......@@ -315,7 +314,7 @@ def test_attribute_version():
def test_string_support():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
attribute = 'this is my long test string with \nNew lines'
outfile.set('string', attribute)
......@@ -329,7 +328,7 @@ def test_string_support():
def test_string_attribute_support():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
attribute = 'this is my long test string with \nNew lines'
outfile.set_attribute('string', attribute)
......@@ -348,7 +347,7 @@ def test_string_attribute_support():
def test_can_use_set_with_iterables():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
data = [1, 34.5, True]
outfile.set('data', data)
......@@ -360,7 +359,7 @@ def test_can_use_set_with_iterables():
def test_has_attribute():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
i = 35
f = 3.14
......@@ -377,7 +376,7 @@ def test_has_attribute():
def test_get_attributes():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
nothing = outfile.get_attributes()
nose.tools.eq_(len(nothing), 0)
......@@ -397,7 +396,7 @@ def test_set_compression():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
data = numpy.random.random((50,50))
outfile.set('data', data, compression=9)
......@@ -413,7 +412,7 @@ def test_append_compression():
try:
tmpname = testutils.temporary_filename()
tmpname = test_utils.temporary_filename()
outfile = HDF5File(tmpname, 'w')
data = numpy.random.random((50,50))
for k in range(len(data)): outfile.append('data', data[k], compression=9)
......
......@@ -20,15 +20,14 @@
"""Runs some image tests
"""
from . import utils as testutils
from . import load, test_utils
# These are some global parameters for the test.
PNG_INDEXED_COLOR = testutils.datafile('img_indexed_color.png', __name__)
PNG_INDEXED_COLOR = test_utils.datafile('img_indexed_color.png', __name__)
def test_png_indexed_color():
# Read an indexed color PNG image, and compared with hardcoded values
from .. import load
img = load(PNG_INDEXED_COLOR)
assert img.shape == (3,22,32)
assert img[0,0,0] == 255
......
......@@ -70,7 +70,7 @@ def ffmpeg_version_lessthan(v):
'''Returns true if the version of ffmpeg compiled-in is at least the version
indicated as a string parameter.'''
from .._externals import versions
from ._externals import versions
if versions['FFmpeg']['ffmpeg'] == 'unavailable': return False
avcodec_inst= SV(versions['FFmpeg']['avcodec'])
avcodec_req = ffmpeg_versions[v][0]
......@@ -101,7 +101,7 @@ def ffmpeg_found(version_geq=None):
@functools.wraps(test)
def wrapper(*args, **kwargs):
try:
from .._externals import versions
from ._externals import versions
avcodec_inst = SV(versions['FFmpeg']['avcodec'])
avformat_inst = SV(versions['FFmpeg']['avformat'])
avutil_inst = SV(versions['FFmpeg']['avutil'])
......@@ -124,7 +124,7 @@ def codec_available(codec):
@functools.wraps(test)
def wrapper(*args, **kwargs):
from ..io import supported_video_codecs
from ._externals import supported_video_codecs
d = supported_video_codecs()
if codec in d and d[codec]['encode'] and d[codec]['decode']:
return test(*args, **kwargs)
......@@ -142,7 +142,7 @@ def extension_available(extension):
@functools.wraps(test)
def wrapper(*args, **kwargs):
from .._externals import extensions
from ._externals import extensions
if extension in extensions():
return test(*args, **kwargs)
else:
......
......@@ -10,16 +10,16 @@
import numpy
import nose.tools
from . import utils as testutils
from . import test_utils
# These are some global parameters for the test.
INPUT_VIDEO = testutils.datafile('test.mov', __name__)
INPUT_VIDEO = test_utils.datafile('test.mov', __name__)
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_codec_support():
# Describes all encoders
from .._externals import describe_encoder, describe_decoder, supported_video_codecs
from ._externals import describe_encoder, describe_decoder, supported_video_codecs
supported = supported_video_codecs()
......@@ -34,11 +34,11 @@ def test_codec_support():
assert supported[codec]['encode']
assert supported[codec]['decode']
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_input_format_support():
# Describes all encoders
from .._externals import supported_videoreader_formats
from ._externals import supported_videoreader_formats
supported = supported_videoreader_formats()
......@@ -46,11 +46,11 @@ def test_input_format_support():
for fmt in ('avi', 'mov', 'mp4'):
assert fmt in supported
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_output_format_support():
# Describes all encoders
from .._externals import supported_videowriter_formats
from ._externals import supported_videowriter_formats
supported = supported_videowriter_formats()
......@@ -58,10 +58,10 @@ def test_output_format_support():
for fmt in ('avi', 'mov', 'mp4'):
assert fmt in supported
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_video_reader_attributes():
from .. import VideoReader
from . import VideoReader
iv = VideoReader(INPUT_VIDEO)
......@@ -88,19 +88,19 @@ def test_video_reader_attributes():
nose.tools.eq_(len(iv.video_type[2]), len(iv.frame_type[2])+1)
assert isinstance(iv.info, str)
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_video_reader_str():
from .. import VideoReader
from . import VideoReader
iv = VideoReader(INPUT_VIDEO)
assert repr(iv)
assert str(iv)
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_can_iterate():
from .. import VideoReader
from . import VideoReader
video = VideoReader(INPUT_VIDEO)
counter = 0
for frame in video:
......@@ -113,10 +113,10 @@ def test_can_iterate():
assert counter == len(video) #we have gone through all frames
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_iteration():
from .. import load, VideoReader
from . import load, VideoReader
f = VideoReader(INPUT_VIDEO)
objs = load(INPUT_VIDEO)
......@@ -124,10 +124,10 @@ def test_iteration():
for l, i in zip(objs, f):
assert numpy.allclose(l, i)
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_indexing():
from .. import VideoReader
from . import VideoReader
f = VideoReader(INPUT_VIDEO)
nose.tools.eq_(len(f), 375)
......@@ -143,30 +143,30 @@ def test_indexing():
assert numpy.allclose(f[len(f)-1], f[-1])
assert numpy.allclose(f[len(f)-2], f[-2])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_empty():
from .. import load, VideoReader
from . import load, VideoReader
f = VideoReader(INPUT_VIDEO)
objs = f[1:1]
assert objs.shape == tuple()
assert objs.dtype == numpy.uint8
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_0():
from .. import load, VideoReader
from . import load, VideoReader
f = VideoReader(INPUT_VIDEO)
objs = f[:]
for i, k in enumerate(load(INPUT_VIDEO)):
assert numpy.allclose(k, objs[i])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_1():
from .. import VideoReader
from . import VideoReader
f = VideoReader(INPUT_VIDEO)
s = f[3:10:2]
......@@ -176,10 +176,10 @@ def test_slicing_1():
assert numpy.allclose(s[2], f[7])
assert numpy.allclose(s[3], f[9])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_2():
from .. import VideoReader
from . import VideoReader
f = VideoReader(INPUT_VIDEO)
s = f[-10:-2:3]
......@@ -188,10 +188,10 @@ def test_slicing_2():
assert numpy.allclose(s[1], f[len(f)-7])
assert numpy.allclose(s[2], f[len(f)-4])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_3():
from .. import VideoReader
from . import VideoReader
f = VideoReader(INPUT_VIDEO)
objs = f.load()
......@@ -203,10 +203,10 @@ def test_slicing_3():
assert numpy.allclose(s[2], f[14])
assert numpy.allclose(s[3], f[11])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_slicing_4():
from .. import VideoReader
from . import VideoReader
f = VideoReader(INPUT_VIDEO)
objs = f[:21]
......@@ -219,10 +219,10 @@ def test_slicing_4():
assert numpy.allclose(s[3], f[len(f)-19])
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def test_can_use_array_interface():
from .. import load, VideoReader
from . import load, VideoReader
array = load(INPUT_VIDEO)
iv = VideoReader(INPUT_VIDEO)
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Andre Anjos <andre.anjos@idiap.ch>
# Tue 12 Nov 09:25:56 2013
# Tue 12 Nov 09:25:56 2013
"""Runs quality tests on video codecs supported
"""
......@@ -9,17 +9,17 @@
import os
import numpy
import nose.tools
from . import utils as testutils
from ..utils import color_distortion, frameskip_detection, quality_degradation
from . import test_utils
from .utils import color_distortion, frameskip_detection, quality_degradation
# These are some global parameters for the test.
INPUT_VIDEO = testutils.datafile('test.mov', __name__)
INPUT_VIDEO = test_utils.datafile('test.mov', __name__)
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def check_format_codec(function, shape, framerate, format, codec, maxdist):
length, height, width = shape
fname = testutils.temporary_filename(suffix='.%s' % format)
fname = test_utils.temporary_filename(suffix='.%s' % format)
try:
orig, framerate, encoded = function(shape, framerate, format, codec, fname)
......@@ -90,7 +90,7 @@ def test_format_codecs():
)
# some exceptions
if testutils.ffmpeg_version_lessthan('0.6'):
if test_utils.ffmpeg_version_lessthan('0.6'):
distortions['ffv1']['frameskip'] = 0.55
distortions['mpeg1video']['frameskip'] = 1.5
distortions['mpegvideo']['color'] = 9.0
......@@ -98,9 +98,9 @@ def test_format_codecs():
distortions['mpeg2video']['color'] = 9.0
distortions['mpeg2video']['frameskip'] = 1.4
from .._externals import versions
from ._externals import versions
if versions['FFmpeg']['ffmpeg'] != 'unavailable':
from .._externals import supported_videowriter_formats
from ._externals import supported_videowriter_formats
SUPPORTED = supported_videowriter_formats()
for format in SUPPORTED:
for codec in SUPPORTED[format]['supported_codecs']:
......@@ -109,11 +109,11 @@ def test_format_codecs():
distortion = distortions.get(codec, distortions['default'])[method]
yield check_format_codec, methods[method], shape, framerate, format, codec, distortion
@testutils.ffmpeg_found()
@test_utils.ffmpeg_found()
def check_user_video(format, codec, maxdist):
from .. import VideoReader, VideoWriter
fname = testutils.temporary_filename(suffix='.%s' % format)
from . import VideoReader, VideoWriter
fname = test_utils.temporary_filename(suffix='.%s' % format)
MAXLENTH = 10 #use only the first 10 frames
try:
......@@ -181,9 +181,9 @@ def test_user_video():
msmpeg4v2 = 2.3,
)
from .._externals import versions
from ._externals import versions
if versions['FFmpeg']['ffmpeg'] != 'unavailable':
from .._externals import supported_videowriter_formats
from ._externals import supported_videowriter_formats
SUPPORTED = supported_videowriter_formats()
for format in SUPPORTED:
for codec in SUPPORTED[format]['supported_codecs']:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment