]>
jfr.im git - yt-dlp.git/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 yt_dlp
.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 yt_dlp'], cwd
=rootDir
)
28 def test_module_exec(self
):
29 subprocess
.check_call([sys
.executable
, '-m', 'yt_dlp', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
31 def test_main_exec(self
):
32 subprocess
.check_call([sys
.executable
, 'yt_dlp/__main__.py', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
34 def test_cmdline_umlauts(self
):
36 [sys
.executable
, 'yt_dlp/__main__.py', encodeArgument('รค'), '--version'],
37 cwd
=rootDir
, stdout
=_DEV_NULL
, stderr
=subprocess
.PIPE
)
38 _
, stderr
= p
.communicate()
39 self
.assertFalse(stderr
)
41 def test_lazy_extractors(self
):
43 subprocess
.check_call([sys
.executable
, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
44 subprocess
.check_call([sys
.executable
, 'test/test_all_urls.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
47 os
.remove('yt_dlp/extractor/lazy_extractors.py')
48 except (IOError, OSError):
52 if __name__
== '__main__':