[test] Convert warnings into errors

* And fix some existing warnings

Authored by: fstirlitz
This commit is contained in:
pukkandan 2022-04-18 02:12:48 +05:30
parent 3d3bb1688b
commit b6dc37fe2a
No known key found for this signature in database
GPG Key ID: 7EEE9E1E817D0A39
9 changed files with 13 additions and 11 deletions

View File

@ -13,4 +13,5 @@ if ["%~1"]==[""] (
exit /b 1 exit /b 1
) )
set PYTHONWARNINGS=error
pytest %test_set% pytest %test_set%

View File

@ -11,4 +11,4 @@ else
exit 1 exit 1
fi fi
python3 -m pytest "$test_set" python3 -bb -Werror -m pytest "$test_set"

View File

@ -66,8 +66,9 @@ class TestHTTPS(unittest.TestCase):
certfn = os.path.join(TEST_DIR, 'testcert.pem') certfn = os.path.join(TEST_DIR, 'testcert.pem')
self.httpd = compat_http_server.HTTPServer( self.httpd = compat_http_server.HTTPServer(
('127.0.0.1', 0), HTTPTestRequestHandler) ('127.0.0.1', 0), HTTPTestRequestHandler)
self.httpd.socket = ssl.wrap_socket( sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
self.httpd.socket, certfile=certfn, server_side=True) sslctx.load_cert_chain(certfn, None)
self.httpd.socket = sslctx.wrap_socket(self.httpd.socket, server_side=True)
self.port = http_server_port(self.httpd) self.port = http_server_port(self.httpd)
self.server_thread = threading.Thread(target=self.httpd.serve_forever) self.server_thread = threading.Thread(target=self.httpd.serve_forever)
self.server_thread.daemon = True self.server_thread.daemon = True

View File

@ -1 +1 @@
@py "%~dp0yt_dlp\__main__.py" %* @py -bb -Werror -Xdev "%~dp0yt_dlp\__main__.py" %*

View File

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
exec python3 "$(dirname "$(realpath "$0")")/yt_dlp/__main__.py" "$@" exec "${PYTHON:-python3}" -bb -Werror -Xdev "$(dirname "$(realpath "$0")")/yt_dlp/__main__.py" "$@"

View File

@ -159,7 +159,7 @@ def windows_enable_vt_mode(): # TODO: Do this the proper way https://bugs.pytho
startupinfo = subprocess.STARTUPINFO() startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
try: try:
subprocess.Popen('', shell=True, startupinfo=startupinfo) subprocess.Popen('', shell=True, startupinfo=startupinfo).wait()
WINDOWS_VT_MODE = True WINDOWS_VT_MODE = True
except Exception: except Exception:
pass pass

View File

@ -11,7 +11,7 @@ from ..utils import (
class GediDigitalIE(InfoExtractor): class GediDigitalIE(InfoExtractor):
_VALID_URL = r'''(?x)(?P<url>(?:https?:)//video\. _VALID_URL = r'''(?x:(?P<url>(?:https?:)//video\.
(?: (?:
(?: (?:
(?:espresso\.)?repubblica (?:espresso\.)?repubblica
@ -33,7 +33,7 @@ class GediDigitalIE(InfoExtractor):
|corrierealpi |corrierealpi
|lasentinella |lasentinella
)\.gelocal )\.gelocal
)\.it(?:/[^/]+){2,4}/(?P<id>\d+))(?:$|[?&].*)''' )\.it(?:/[^/]+){2,4}/(?P<id>\d+))(?:$|[?&].*))'''
_TESTS = [{ _TESTS = [{
'url': 'https://video.lastampa.it/politica/il-paradosso-delle-regionali-la-lega-vince-ma-sembra-aver-perso/121559/121683', 'url': 'https://video.lastampa.it/politica/il-paradosso-delle-regionali-la-lega-vince-ma-sembra-aver-perso/121559/121683',
'md5': '84658d7fb9e55a6e57ecc77b73137494', 'md5': '84658d7fb9e55a6e57ecc77b73137494',

View File

@ -10,7 +10,7 @@ from ..utils import (
class GfycatIE(InfoExtractor): class GfycatIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:(?:www|giant|thumbs)\.)?gfycat\.com/(?:ru/|ifr/|gifs/detail/)?(?P<id>[^-/?#\."\']+)' _VALID_URL = r'https?://(?:(?:www|giant|thumbs)\.)?gfycat\.com/(?i:ru/|ifr/|gifs/detail/)?(?P<id>[^-/?#\."\']+)'
_TESTS = [{ _TESTS = [{
'url': 'http://gfycat.com/DeadlyDecisiveGermanpinscher', 'url': 'http://gfycat.com/DeadlyDecisiveGermanpinscher',
'info_dict': { 'info_dict': {

View File

@ -12,14 +12,14 @@ from ..utils import (
class WimTVIE(InfoExtractor): class WimTVIE(InfoExtractor):
_player = None _player = None
_UUID_RE = r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}' _UUID_RE = r'[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}'
_VALID_URL = r'''(?x) _VALID_URL = r'''(?x:
https?://platform.wim.tv/ https?://platform.wim.tv/
(?: (?:
(?:embed/)?\? (?:embed/)?\?
|\#/webtv/.+?/ |\#/webtv/.+?/
) )
(?P<type>vod|live|cast)[=/] (?P<type>vod|live|cast)[=/]
(?P<id>%s).*?''' % _UUID_RE (?P<id>%s).*?)''' % _UUID_RE
_TESTS = [{ _TESTS = [{
# vod stream # vod stream
'url': 'https://platform.wim.tv/embed/?vod=db29fb32-bade-47b6-a3a6-cb69fe80267a', 'url': 'https://platform.wim.tv/embed/?vod=db29fb32-bade-47b6-a3a6-cb69fe80267a',