Make packager_test.py work with python 3.0
Use logging instead of print. Fixes #553. Change-Id: I46b9a5bb9bb5d4cb03ddd94163905aebc4b4e9dd
This commit is contained in:
parent
72c4797a59
commit
de534f8550
|
@ -7,6 +7,7 @@
|
|||
# https://developers.google.com/open-source/licenses/bsd
|
||||
"""Test wrapper for the sample packager binaries."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
|
@ -68,7 +69,7 @@ class PackagerApp(object):
|
|||
self.packaging_command_line = ' '.join(["'%s'" % entry for entry in cmd])
|
||||
packaging_result = subprocess.call(cmd, env=self.GetEnv())
|
||||
if packaging_result != 0:
|
||||
print '%s returned non-0 status' % self.packaging_command_line
|
||||
logging.error('%s returned non-0 status', self.packaging_command_line)
|
||||
return packaging_result
|
||||
|
||||
def GetCommandLine(self):
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
import filecmp
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
@ -192,7 +193,7 @@ def _UpdateMpdTimes(mpd_filepath):
|
|||
if m:
|
||||
old = m.group(0)
|
||||
out = str_in.replace(old, new)
|
||||
print 'Replacing "%s" with "%s"' % (old, new)
|
||||
logging.info('Replacing "%s" with "%s"', old, new)
|
||||
else:
|
||||
out = str_in
|
||||
|
||||
|
@ -233,6 +234,7 @@ def GetSegmentedExtension(base_extension):
|
|||
class PackagerAppTest(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PackagerAppTest, self).setUp()
|
||||
self.packager = packager_app.PackagerApp()
|
||||
self.tmp_dir = tempfile.mkdtemp()
|
||||
self.test_data_dir = os.path.join(test_env.SRC_DIR, 'packager', 'media',
|
||||
|
@ -262,6 +264,7 @@ class PackagerAppTest(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
if test_env.options.remove_temp_files_after_test:
|
||||
shutil.rmtree(self.tmp_dir)
|
||||
super(PackagerAppTest, self).tearDown()
|
||||
|
||||
def _GetStream(self,
|
||||
descriptor,
|
||||
|
@ -1488,7 +1491,7 @@ class PackagerFunctionalTest(PackagerAppTest):
|
|||
test_files=['bear-1280x720.mp4', 'bear-640x360.mp4',
|
||||
'bear-320x180.mp4']), flags)
|
||||
with open(self.mpd_output, 'rb') as f:
|
||||
print f.read()
|
||||
logging.info(f.read())
|
||||
# TODO(kqyang): Add some validations.
|
||||
|
||||
@unittest.skipUnless(test_env.has_aes_flags, 'Requires AES credentials.')
|
||||
|
|
Loading…
Reference in New Issue