]>
jfr.im git - yt-dlp.git/blob - test/test_execution.py
7 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
9 from yt_dlp
.utils
import encodeArgument
11 rootDir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
15 _DEV_NULL
= subprocess
.DEVNULL
16 except AttributeError:
17 _DEV_NULL
= open(os
.devnull
, 'wb')
20 class TestExecution(unittest
.TestCase
):
21 def test_import(self
):
22 subprocess
.check_call([sys
.executable
, '-c', 'import yt_dlp'], cwd
=rootDir
)
24 def test_module_exec(self
):
25 subprocess
.check_call([sys
.executable
, '-m', 'yt_dlp', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
27 def test_main_exec(self
):
28 subprocess
.check_call([sys
.executable
, 'yt_dlp/__main__.py', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
30 def test_cmdline_umlauts(self
):
32 [sys
.executable
, 'yt_dlp/__main__.py', encodeArgument('รค'), '--version'],
33 cwd
=rootDir
, stdout
=_DEV_NULL
, stderr
=subprocess
.PIPE
)
34 _
, stderr
= p
.communicate()
35 self
.assertFalse(stderr
)
37 def test_lazy_extractors(self
):
39 subprocess
.check_call([sys
.executable
, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
40 subprocess
.check_call([sys
.executable
, 'test/test_all_urls.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
43 os
.remove('yt_dlp/extractor/lazy_extractors.py')
48 if __name__
== '__main__':