You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
884 B

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