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.

26 lines
817 B

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