apps: gstvalidate.py: fix various pyflakes / uncaught pep8 issues.

https://bugzilla.gnome.org/show_bug.cgi?id=739208
This commit is contained in:
Mathieu Duponchelle 2014-10-25 14:59:49 +02:00
parent 9bdc6e9b6d
commit 7bbd3ed288

View file

@ -24,13 +24,13 @@ import subprocess
import ConfigParser import ConfigParser
from loggable import Loggable from loggable import Loggable
from baseclasses import GstValidateTest, TestsManager, Test, \ from baseclasses import GstValidateTest, Test, \
ScenarioManager, NamedDic, GstValidateTestsGenerator, \ ScenarioManager, NamedDic, GstValidateTestsGenerator, \
GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \ GstValidateMediaDescriptor, GstValidateEncodingTestInterface, \
GstValidateBaseTestManager GstValidateBaseTestManager
from utils import path2url, DEFAULT_TIMEOUT, which, \ from utils import path2url, DEFAULT_TIMEOUT, which, \
GST_SECOND, Result, Protocols GST_SECOND, Result, Protocols, mkdir, printc, Colors
# #
# Private global variables # # Private global variables #
@ -110,9 +110,8 @@ class GstValidateTranscodingTestsGenerator(GstValidateTestsGenerator):
class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator): class GstValidatePipelineTestsGenerator(GstValidateTestsGenerator):
def __init__( def __init__(self, name, test_manager, pipeline_template=None,
self, name, test_manager, pipeline_template=None, pipelines_descriptions=None, pipelines_descriptions=None, valid_scenarios=[]):
valid_scenarios=[]):
""" """
@name: The name of the generator @name: The name of the generator
@pipeline_template: A template pipeline to be used to generate actual pipelines @pipeline_template: A template pipeline to be used to generate actual pipelines
@ -206,9 +205,8 @@ class GstValidatePlaybinTestsGenerator(GstValidatePipelineTestsGenerator):
class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator): class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
def __init__( def __init__(self, name, test_manager, mixer, media_type, converter="",
self, name, test_manager, mixer, media_type, converter="", num_sources=3, num_sources=3, mixed_srcs={}, valid_scenarios=[]):
mixed_srcs={}, valid_scenarios=[]):
pipe_template = "%(mixer)s name=_mixer ! " + \ pipe_template = "%(mixer)s name=_mixer ! " + \
converter + " ! %(sink)s " converter + " ! %(sink)s "
self.converter = converter self.converter = converter
@ -233,7 +231,6 @@ class GstValidateMixerTestsGenerator(GstValidatePipelineTestsGenerator):
return return
for i in range(len(uri_minfo_special_scenarios) / self.num_sources): for i in range(len(uri_minfo_special_scenarios) / self.num_sources):
can_run = True
srcs = [] srcs = []
name = "" name = ""
for nsource in range(self.num_sources): for nsource in range(self.num_sources):
@ -337,9 +334,8 @@ class GstValidateLaunchTest(GstValidateTest):
class GstValidateMediaCheckTest(Test): class GstValidateMediaCheckTest(Test):
def __init__( def __init__(self, classname, options, reporter, media_descriptor,
self, classname, options, reporter, media_descriptor, uri, minfo_path, uri, minfo_path, timeout=DEFAULT_TIMEOUT):
timeout=DEFAULT_TIMEOUT):
super( super(
GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname, GstValidateMediaCheckTest, self).__init__(G_V_DISCOVERER_COMMAND, classname,
options, reporter, options, reporter,
@ -393,10 +389,10 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
self.uri = uri self.uri = uri
def set_rendering_info(self): def set_rendering_info(self):
self.dest_file = path = os.path.join(self.options.dest, self.dest_file = os.path.join(self.options.dest,
self.classname.replace(".transcode.", os.sep). self.classname.replace(".transcode.", os.sep).
replace(".", os.sep)) replace(".", os.sep))
utils.mkdir(os.path.dirname(urlparse.urlsplit(self.dest_file).path)) mkdir(os.path.dirname(urlparse.urlsplit(self.dest_file).path))
if urlparse.urlparse(self.dest_file).scheme == "": if urlparse.urlparse(self.dest_file).scheme == "":
self.dest_file = path2url(self.dest_file) self.dest_file = path2url(self.dest_file)
@ -438,12 +434,6 @@ class GstValidateTranscodingTest(GstValidateTest, GstValidateEncodingTestInterfa
GstValidateTest.check_results(self) GstValidateTest.check_results(self)
return return
if self.scenario:
orig_duration = min(long(self.scenario.get_duration()),
long(self.media_descriptor.get_duration()))
else:
orig_duration = long(self.media_descriptor.get_duration())
res, msg = self.check_encoded_file() res, msg = self.check_encoded_file()
self.set_result(res, msg) self.set_result(res, msg)
@ -476,7 +466,7 @@ class GstValidateTestManager(GstValidateBaseTestManager):
return False return False
def add_options(self, parser): def add_options(self, parser):
group = parser.add_argument_group("GstValidate tools specific options" parser.add_argument_group("GstValidate tools specific options"
" and behaviours", " and behaviours",
description="""When using --wanted-tests, all the scenarios can be used, even those which have description="""When using --wanted-tests, all the scenarios can be used, even those which have
not been tested and explicitely activated if you set use --wanted-tests ALL""") not been tested and explicitely activated if you set use --wanted-tests ALL""")