diff src/test/test_plugin_misc_radiocol.py @ 861:4d091738275c

test: skip radiocol tests if the sound samples are not found
author souliane <souliane@mailoo.org>
date Mon, 24 Feb 2014 12:57:56 +0100
parents c5a8f602662b
children 95dabdb0c799
line wrap: on
line diff
--- a/src/test/test_plugin_misc_radiocol.py	Mon Feb 24 12:21:59 2014 +0100
+++ b/src/test/test_plugin_misc_radiocol.py	Mon Feb 24 12:57:56 2014 +0100
@@ -32,6 +32,7 @@
 from twisted.internet import reactor
 from twisted.internet import defer
 from twisted.python.failure import Failure
+from twisted.trial.unittest import SkipTest
 
 from mutagen.oggvorbis import OggVorbis
 
@@ -70,9 +71,12 @@
         self.songs = []
         self.playlist = []
         self.sound_dir = self.host.memory.getConfig('', 'media_dir') + '/test/sound/'
-        for filename in os.listdir(self.sound_dir):
-            if filename.endswith('.ogg'):
-                self.songs.append(filename)
+        try:
+            for filename in os.listdir(self.sound_dir):
+                if filename.endswith('.ogg'):
+                    self.songs.append(filename)
+        except OSError:
+            raise SkipTest('The sound samples in sat_media/test/sound were not found')
 
     def _buildPlayers(self, players=[]):
         """@return: the "started" content built with the given players"""