]> git.parisson.com Git - timeside.git/commitdiff
new check_samples function
authoryomguy <yomguy@parisson.com>
Wed, 19 Sep 2012 12:18:45 +0000 (14:18 +0200)
committeryomguy <yomguy@parisson.com>
Wed, 19 Sep 2012 12:18:45 +0000 (14:18 +0200)
tests/samples/guitar.wav [deleted file]
tests/samples/sweep.flac [deleted file]
tests/samples/sweep.mp3 [deleted file]
tests/samples/sweep.ogg [deleted file]
tests/samples/sweep.wav [deleted file]
tests/samples/sweep_source.wav [deleted file]
tests/tools.py [new file with mode: 0644]
tests/unit_timeside.py

diff --git a/tests/samples/guitar.wav b/tests/samples/guitar.wav
deleted file mode 100644 (file)
index b5a9e80..0000000
Binary files a/tests/samples/guitar.wav and /dev/null differ
diff --git a/tests/samples/sweep.flac b/tests/samples/sweep.flac
deleted file mode 100644 (file)
index decee06..0000000
Binary files a/tests/samples/sweep.flac and /dev/null differ
diff --git a/tests/samples/sweep.mp3 b/tests/samples/sweep.mp3
deleted file mode 100644 (file)
index dc75fe0..0000000
Binary files a/tests/samples/sweep.mp3 and /dev/null differ
diff --git a/tests/samples/sweep.ogg b/tests/samples/sweep.ogg
deleted file mode 100644 (file)
index e30bf99..0000000
Binary files a/tests/samples/sweep.ogg and /dev/null differ
diff --git a/tests/samples/sweep.wav b/tests/samples/sweep.wav
deleted file mode 100644 (file)
index fc28a32..0000000
Binary files a/tests/samples/sweep.wav and /dev/null differ
diff --git a/tests/samples/sweep_source.wav b/tests/samples/sweep_source.wav
deleted file mode 100644 (file)
index 5dcf9ba..0000000
Binary files a/tests/samples/sweep_source.wav and /dev/null differ
diff --git a/tests/tools.py b/tests/tools.py
new file mode 100644 (file)
index 0000000..63a0f59
--- /dev/null
@@ -0,0 +1,20 @@
+import os
+import urllib
+
+def check_samples():
+    url = 'http://github.com/yomguy/timeside-samples/raw/master/samples/'
+    samples = ['guitar.wav', 'sweep.wav', 'sweep.flac', 'sweep.ogg', 'sweep.mp3', 'sweep_source.wav']
+    path = os.path.normpath(os.path.dirname(__file__))
+    dir = path + os.sep + 'samples'
+
+    if not os.path.exists(dir):
+        os.makedirs(dir)
+
+    for sample in samples:
+        path = dir + os.sep + sample
+        if not os.path.exists(path):
+            print 'downloading: ' + sample
+            f = open(path, 'w')
+            u = urllib.urlopen(url+sample)
+            f.write(u.read())
+            f.close()
index 09bc2d62ae02128bab286040ca8b16c31e36ffd2..f31ac4cc21269343e7ba267ac01d760931741f17 100644 (file)
@@ -1,8 +1,9 @@
 # -*- coding: utf-8 -*-
 
 import unittest
-import sys
+import os, sys
 import time
+from tools import *
 
 class TestCase(unittest.TestCase):
 
@@ -98,16 +99,19 @@ class _WritelnDecorator:
         if arg: self.write(arg)
         self.write('\n') # text-mode streams translate to \r\n if needed
 
+
 class TestRunner:
     """A test runner class that displays results in textual form.
 
     It prints out the names of tests as they are run, errors as they
     occur, and a summary of the results at the end of the test run.
     """
+
     def __init__(self, stream=sys.stderr, descriptions=1, verbosity=2):
         self.stream = _WritelnDecorator(stream)
         self.descriptions = descriptions
         self.verbosity = verbosity
+        check_samples()
 
     def _makeResult(self):
         return _TextTestResult(self.stream, self.descriptions, self.verbosity)