launcher: Minor indentation issue fixes

This commit is contained in:
Thibault Saunier 2018-03-23 18:02:43 -03:00
parent 2b40c6c306
commit cd1c4eb44d

View file

@ -417,14 +417,16 @@ class Test(Loggable):
vg_config = get_data_file('data', 'valgrind.config') vg_config = get_data_file('data', 'valgrind.config')
if self.proc_env.get('GST_VALIDATE_CONFIG'): if self.proc_env.get('GST_VALIDATE_CONFIG'):
subenv['GST_VALIDATE_CONFIG'] = '%s%s%s' % (self.proc_env['GST_VALIDATE_CONFIG'], os.pathsep, vg_config) subenv['GST_VALIDATE_CONFIG'] = '%s%s%s' % (
self.proc_env['GST_VALIDATE_CONFIG'], os.pathsep, vg_config)
else: else:
subenv['GST_VALIDATE_CONFIG'] = vg_config subenv['GST_VALIDATE_CONFIG'] = vg_config
if subenv == self.proc_env: if subenv == self.proc_env:
self.add_env_variable('G_DEBUG', 'gc-friendly') self.add_env_variable('G_DEBUG', 'gc-friendly')
self.add_env_variable('G_SLICE', 'always-malloc') self.add_env_variable('G_SLICE', 'always-malloc')
self.add_env_variable('GST_VALIDATE_CONFIG', self.proc_env['GST_VALIDATE_CONFIG']) self.add_env_variable('GST_VALIDATE_CONFIG',
self.proc_env['GST_VALIDATE_CONFIG'])
return command return command
@ -535,9 +537,11 @@ class Test(Loggable):
return self.result return self.result
class GstValidateTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer): class GstValidateTCPServer(socketserver.ThreadingMixIn, socketserver.TCPServer):
pass pass
class GstValidateListener(socketserver.BaseRequestHandler): class GstValidateListener(socketserver.BaseRequestHandler):
def handle(self): def handle(self):
"""Implements BaseRequestHandler handle method""" """Implements BaseRequestHandler handle method"""
@ -564,7 +568,8 @@ class GstValidateListener(socketserver.BaseRequestHandler):
test = t test = t
break break
if test is None: if test is None:
self.server.launcher.error("Could not find test for UUID %s" % uuid) self.server.launcher.error(
"Could not find test for UUID %s" % uuid)
return return
obj_type = obj.get("type", '') obj_type = obj.get("type", '')
@ -674,7 +679,8 @@ class GstValidateTest(Test):
def get_override_file(self, media_descriptor): def get_override_file(self, media_descriptor):
if media_descriptor: if media_descriptor:
if media_descriptor.get_path(): if media_descriptor.get_path():
override_path = os.path.splitext(media_descriptor.get_path())[0] + VALIDATE_OVERRIDE_EXTENSION override_path = os.path.splitext(media_descriptor.get_path())[
0] + VALIDATE_OVERRIDE_EXTENSION
if os.path.exists(override_path): if os.path.exists(override_path):
return override_path return override_path
@ -1319,7 +1325,8 @@ class _TestsLauncher(Loggable):
files = [] files = []
for f in files: for f in files:
if f.endswith(".py"): if f.endswith(".py"):
exec(compile(open(os.path.join(app_dir, f)).read(), os.path.join(app_dir, f), 'exec'), env) exec(compile(open(os.path.join(app_dir, f)).read(),
os.path.join(app_dir, f), 'exec'), env)
def _exec_apps(self, env): def _exec_apps(self, env):
app_dirs = self._list_app_dirs() app_dirs = self._list_app_dirs()
@ -1371,7 +1378,8 @@ class _TestsLauncher(Loggable):
if not loaded_module[0]: if not loaded_module[0]:
if "." in testsuite: if "." in testsuite:
self.options.testsuites.append(testsuite.split('.')[0]) self.options.testsuites.append(testsuite.split('.')[0])
self.info("%s looks like a test name, trying that" % testsuite) self.info("%s looks like a test name, trying that" %
testsuite)
self.options.wanted_tests.append(testsuite) self.options.wanted_tests.append(testsuite)
else: else:
printc("Could not load testsuite: %s, reasons: %s" % ( printc("Could not load testsuite: %s, reasons: %s" % (
@ -1426,7 +1434,8 @@ class _TestsLauncher(Loggable):
globals()["options"] = options globals()["options"] = options
c__file__ = __file__ c__file__ = __file__
globals()["__file__"] = self.options.config globals()["__file__"] = self.options.config
exec(compile(open(self.options.config).read(), self.options.config, 'exec'), globals()) exec(compile(open(self.options.config).read(),
self.options.config, 'exec'), globals())
globals()["__file__"] = c__file__ globals()["__file__"] = c__file__
def set_settings(self, options, args): def set_settings(self, options, args):
@ -1999,7 +2008,8 @@ class MediaDescriptor(Loggable):
return False return False
if self.is_live() and not scenario.compatible_with_live_content(): if self.is_live() and not scenario.compatible_with_live_content():
self.debug("Do not run %s as %s is a live content", scenario, self.get_uri()) self.debug("Do not run %s as %s is a live content",
scenario, self.get_uri())
return False return False
if not self.prerrols() and getattr(scenario, 'needs_preroll', False): if not self.prerrols() and getattr(scenario, 'needs_preroll', False):
@ -2044,9 +2054,10 @@ class GstValidateMediaDescriptor(MediaDescriptor):
Colors.FAIL) Colors.FAIL)
raise raise
self._extract_data (media_xml) self._extract_data(media_xml)
self.set_protocol(urllib.parse.urlparse(urllib.parse.urlparse(self.get_uri()).scheme).scheme) self.set_protocol(urllib.parse.urlparse(
urllib.parse.urlparse(self.get_uri()).scheme).scheme)
def _extract_data(self, media_xml): def _extract_data(self, media_xml):
# Extract the information we need from the xml # Extract the information we need from the xml
@ -2058,7 +2069,8 @@ class GstValidateMediaDescriptor(MediaDescriptor):
pass pass
else: else:
for stream in streams: for stream in streams:
self._track_caps.append((stream.attrib["type"], stream.attrib["caps"])) self._track_caps.append(
(stream.attrib["type"], stream.attrib["caps"]))
self._uri = media_xml.attrib["uri"] self._uri = media_xml.attrib["uri"]
self._duration = int(media_xml.attrib["duration"]) self._duration = int(media_xml.attrib["duration"])
self._protocol = media_xml.get("protocol", None) self._protocol = media_xml.get("protocol", None)
@ -2112,7 +2124,8 @@ class GstValidateMediaDescriptor(MediaDescriptor):
if verbose: if verbose:
printc("Result: Failed", Colors.FAIL) printc("Result: Failed", Colors.FAIL)
else: else:
loggable.warning("GstValidateMediaDescriptor", "Exception: %s" % e) loggable.warning("GstValidateMediaDescriptor",
"Exception: %s" % e)
return None return None
if verbose: if verbose: