diff options
author | Philipp Hagemeister <[email protected]> | 2012-12-12 15:14:58 +0100 |
---|---|---|
committer | Philipp Hagemeister <[email protected]> | 2012-12-12 15:14:58 +0100 |
commit | 5d01a64719607e4ade7e0dc069efea9888ed2e5d (patch) | |
tree | 4981719d59b62343ece58e79dcf15948f0dd5bbe /test/test_download.py | |
parent | a276e060806c6cabc76b9df964db67939b643e43 (diff) | |
download | youtube-dl-5d01a64719607e4ade7e0dc069efea9888ed2e5d.tar.gz youtube-dl-5d01a64719607e4ade7e0dc069efea9888ed2e5d.zip |
Revert "Don't be too clever"
This reverts commit a276e060806c6cabc76b9df964db67939b643e43.
Diffstat (limited to 'test/test_download.py')
-rw-r--r-- | test/test_download.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test_download.py b/test/test_download.py index 114ff1783..bce0e4fcd 100644 --- a/test/test_download.py +++ b/test/test_download.py @@ -49,13 +49,14 @@ class TestDownload(unittest.TestCase): self.tearDown() def tearDown(self): - for test in self.defs: - fn = test['file'] + for fn in [ test.get('file', False) for test in self.defs ]: if fn and os.path.exists(fn): os.remove(fn) -def make_test_method(test_case): +### Dinamically generate tests +def generator(test_case): + def test_template(self): ie = getattr(youtube_dl.InfoExtractors, test_case['name'] + 'IE') if not ie._WORKING: @@ -80,13 +81,14 @@ def make_test_method(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 = make_test_method(test_case) + test_method = generator(test_case) test_method.__name__ = "test_{0}".format(test_case["name"]) setattr(TestDownload, test_method.__name__, test_method) + del test_method if __name__ == '__main__': |