]>
jfr.im git - yt-dlp.git/blob - test/test_execution.py
8 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
10 from yt_dlp
.utils
import encodeArgument
12 rootDir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
16 _DEV_NULL
= subprocess
.DEVNULL
17 except AttributeError:
18 _DEV_NULL
= open(os
.devnull
, 'wb')
21 class TestExecution(unittest
.TestCase
):
22 def test_import(self
):
23 subprocess
.check_call([sys
.executable
, '-c', 'import yt_dlp'], cwd
=rootDir
)
25 def test_module_exec(self
):
26 subprocess
.check_call([sys
.executable
, '-m', 'yt_dlp', '--ignore-config', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
28 def test_main_exec(self
):
29 subprocess
.check_call([sys
.executable
, 'yt_dlp/__main__.py', '--ignore-config', '--version'], cwd
=rootDir
, stdout
=_DEV_NULL
)
31 def test_cmdline_umlauts(self
):
33 [sys
.executable
, 'yt_dlp/__main__.py', '--ignore-config', encodeArgument('รค'), '--version'],
34 cwd
=rootDir
, stdout
=_DEV_NULL
, stderr
=subprocess
.PIPE
)
35 _
, stderr
= p
.communicate()
36 self
.assertFalse(stderr
)
38 def test_lazy_extractors(self
):
40 subprocess
.check_call([sys
.executable
, 'devscripts/make_lazy_extractors.py', 'yt_dlp/extractor/lazy_extractors.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
41 subprocess
.check_call([sys
.executable
, 'test/test_all_urls.py'], cwd
=rootDir
, stdout
=_DEV_NULL
)
43 with contextlib
.suppress(OSError):
44 os
.remove('yt_dlp/extractor/lazy_extractors.py')
47 if __name__
== '__main__':