]>
Commit | Line | Data |
---|---|---|
a0f59cdc PH |
1 | #!/usr/bin/env python |
2 | from __future__ import unicode_literals | |
3 | ||
e575b682 PH |
4 | import unittest |
5 | ||
6 | import sys | |
7 | import os | |
8 | import subprocess | |
9 | ||
10 | rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
11 | ||
a0f59cdc | 12 | |
e575b682 PH |
13 | try: |
14 | _DEV_NULL = subprocess.DEVNULL | |
15 | except AttributeError: | |
16 | _DEV_NULL = open(os.devnull, 'wb') | |
17 | ||
a0f59cdc | 18 | |
e575b682 PH |
19 | class TestExecution(unittest.TestCase): |
20 | def test_import(self): | |
21 | subprocess.check_call([sys.executable, '-c', 'import youtube_dl'], cwd=rootDir) | |
22 | ||
23 | def test_module_exec(self): | |
a0f59cdc | 24 | if sys.version_info >= (2, 7): # Python 2.6 doesn't support package execution |
e575b682 PH |
25 | subprocess.check_call([sys.executable, '-m', 'youtube_dl', '--version'], cwd=rootDir, stdout=_DEV_NULL) |
26 | ||
27 | def test_main_exec(self): | |
28 | subprocess.check_call([sys.executable, 'youtube_dl/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL) | |
29 | ||
30 | if __name__ == '__main__': | |
31 | unittest.main() |