aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2012-12-12 15:00:03 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2012-12-12 15:00:03 +0100
commita276e060806c6cabc76b9df964db67939b643e43 (patch)
tree612bd4299b26a8833b5ce7c6c564774f17a34a4b /test
parentfd5ff02042909120bb5eecc3f884ad809dbe25e3 (diff)
Don't be too clever
Diffstat (limited to 'test')
-rw-r--r--test/test_download.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/test/test_download.py b/test/test_download.py
index bce0e4fcd..114ff1783 100644
--- a/test/test_download.py
+++ b/test/test_download.py
@@ -49,14 +49,13 @@ class TestDownload(unittest.TestCase):
self.tearDown()
def tearDown(self):
- for fn in [ test.get('file', False) for test in self.defs ]:
+ for test in self.defs:
+ fn = test['file']
if fn and os.path.exists(fn):
os.remove(fn)
-### Dinamically generate tests
-def generator(test_case):
-
+def make_test_method(test_case):
def test_template(self):
ie = getattr(youtube_dl.InfoExtractors, test_case['name'] + 'IE')
if not ie._WORKING:
@@ -81,14 +80,13 @@ def generator(test_case):
md5_for_file = _file_md5(test_case['file'])
self.assertEqual(md5_for_file, test_case['md5'])
+ # TODO proper skipping annotations
return test_template
-### And add them to TestDownload
for test_case in defs:
- test_method = generator(test_case)
+ test_method = make_test_method(test_case)
test_method.__name__ = "test_{0}".format(test_case["name"])
setattr(TestDownload, test_method.__name__, test_method)
- del test_method
if __name__ == '__main__':