]> jfr.im git - yt-dlp.git/blame - test/test_execution.py
[__init__] Modernize
[yt-dlp.git] / test / test_execution.py
CommitLineData
e575b682
PH
1import unittest
2
3import sys
4import os
5import subprocess
6
7rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
8
9try:
10 _DEV_NULL = subprocess.DEVNULL
11except AttributeError:
12 _DEV_NULL = open(os.devnull, 'wb')
13
14class TestExecution(unittest.TestCase):
15 def test_import(self):
16 subprocess.check_call([sys.executable, '-c', 'import youtube_dl'], cwd=rootDir)
17
18 def test_module_exec(self):
19 if sys.version_info >= (2,7): # Python 2.6 doesn't support package execution
20 subprocess.check_call([sys.executable, '-m', 'youtube_dl', '--version'], cwd=rootDir, stdout=_DEV_NULL)
21
22 def test_main_exec(self):
23 subprocess.check_call([sys.executable, 'youtube_dl/__main__.py', '--version'], cwd=rootDir, stdout=_DEV_NULL)
24
25if __name__ == '__main__':
26 unittest.main()