]> git.parisson.com Git - timeside.git/commitdiff
Encoder: Fix test_encoding for webm video
authorThomas Fillon <thomas@parisson.com>
Thu, 28 Nov 2013 16:54:27 +0000 (17:54 +0100)
committerThomas Fillon <thomas@parisson.com>
Thu, 28 Nov 2013 16:54:27 +0000 (17:54 +0100)
tests/test_encoding.py

index b8b30a8b29f5a936d8d4833720555ae9d62846de..693f0c37ccbd9204974360862e759fb47c34de6a 100755 (executable)
@@ -79,12 +79,13 @@ class TestEncoding(unittest.TestCase):
         self.encoder_function = WebMEncoder
         self.test_duration = False  # webmmux encoder with streamable=true
                                     # does not return a valid duration
-        file_extension = '.' + self.encoder_function.file_extension()
-        self.sink = tmp_file_sink(prefix=self.__class__.__name__,
+        if not hasattr(self, 'sink'):
+            file_extension = '.' + self.encoder_function.file_extension()
+            self.sink = tmp_file_sink(prefix=self.__class__.__name__,
                                       suffix=file_extension)
-        self.encoder = self.encoder_function(self.sink,
-                                             overwrite=self.overwrite,
-                                             video=True)
+            self.encoder = self.encoder_function(self.sink,
+                                                 overwrite=self.overwrite,
+                                                 video=True)
 
     def tearDown(self):
 
@@ -93,8 +94,8 @@ class TestEncoding(unittest.TestCase):
         decoder = ArrayDecoder(self.generate_source(),
                                samplerate=self.samplerate)
         # Encoder
-        file_extension = '.' + self.encoder_function.file_extension()
         if not hasattr(self, 'sink'):
+            file_extension = '.' + self.encoder_function.file_extension()
             self.sink = tmp_file_sink(prefix=self.__class__.__name__,
                                       suffix=file_extension)