* morituri/test/test_common_encode.py:

Work around https://bugzilla.gnome.org/show_bug.cgi?id=688625
This commit is contained in:
Thomas Vander Stichele
2012-11-19 20:44:53 +00:00
parent 3dc88a4a28
commit d0435dc2ab
2 changed files with 18 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
2012-11-19 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/test/test_common_encode.py:
Work around https://bugzilla.gnome.org/show_bug.cgi?id=688625
2012-11-19 Thomas Vander Stichele <thomas at apestaart dot org> 2012-11-19 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/test/common.py: * morituri/test/common.py:

View File

@@ -19,22 +19,31 @@ from morituri.test import common
class PathTestCase(common.TestCase): class PathTestCase(common.TestCase):
def _testSuffix(self, suffix): def _testSuffix(self, suffix):
# because of https://bugzilla.gnome.org/show_bug.cgi?id=688625
# we first create the file with a 'normal' filename, then rename
self.runner = task.SyncRunner(verbose=False) self.runner = task.SyncRunner(verbose=False)
fd, path = tempfile.mkstemp(suffix=suffix) fd, path = tempfile.mkstemp()
cmd = "gst-launch " \ cmd = "gst-launch " \
"audiotestsrc num-buffers=100 samplesperbuffer=1024 ! " \ "audiotestsrc num-buffers=100 samplesperbuffer=1024 ! " \
"audioconvert ! audio/x-raw-int,width=16,depth=16,channels =2 ! " \ "audioconvert ! audio/x-raw-int,width=16,depth=16,channels =2 ! " \
"wavenc ! " \ "wavenc ! " \
"filesink location=\"%s\" > /dev/null 2>&1" % ( "filesink location=\"%s\" > /dev/null 2>&1" % (
gstreamer.quoteParse(path).encode('utf-8'), ) gstreamer.quoteParse(path).encode('utf-8'), )
self.debug('Running cmd %r' % cmd)
os.system(cmd) os.system(cmd)
self.failUnless(os.path.exists(path)) self.failUnless(os.path.exists(path))
encodetask = encode.EncodeTask(path, path + '.out', os.close(fd)
fd, newpath = tempfile.mkstemp(suffix=suffix)
os.rename(path, newpath)
encodetask = encode.EncodeTask(newpath, newpath + '.out',
encode.WavProfile()) encode.WavProfile())
self.runner.run(encodetask, verbose=False) self.runner.run(encodetask, verbose=False)
os.close(fd) os.close(fd)
os.unlink(path) os.unlink(newpath)
os.unlink(path + '.out') os.unlink(newpath + '.out')
class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin): class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):