]>
Raphaël G. Git Repositories - youtubedl/blob - test/test_execution.py
4 from __future__
import unicode_literals
11 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
13 from youtube_dl
.utils
import encodeArgument
15 rootDir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
19 _DEV_NULL
= subprocess
.DEVNULL
20 except AttributeError:
21 _DEV_NULL
= open(os
.devnull
, 'wb')
24 class TestExecution(unittest
.TestCase
):
25 def test_import(self
):
26 subprocess
.check_call([sys
.executable
, '-c', 'import youtube_dl'], cwd
=rootDir
)
28 def test_module_exec(self
):
29 if sys
.version_info
>= (2, 7): # Python 2.6 doesn't support package execution
30 subprocess
.check_call([sys
.executable
, '-m', 'youtube_dl', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
32 def test_main_exec(self
):
33 subprocess
.check_call([sys
.executable
, 'youtube_dl/__main__.py', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
35 def test_cmdline_umlauts(self
):
37 [sys
.executable
, 'youtube_dl/__main__.py', encodeArgument('ä'), '--version'],
38 cwd
=rootDir
, stdout
=_DEV_NULL
, stderr
=subprocess
.PIPE
)
39 _
, stderr
= p
.communicate()
40 self
.assertFalse(stderr
)
42 if __name__
== '__main__':