Merge pull request #9957 from tk0miya/refactor_DeprecationWarnings

Reduce DeprecationWarnings
This commit is contained in:
Takeshi KOMIYA 2021-12-16 01:38:32 +09:00 committed by GitHub
commit 3626c75de0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View File

@ -30,10 +30,10 @@ def test_theme_api(app, status, warning):
themes.append('alabaster') themes.append('alabaster')
# test Theme class API # test Theme class API
assert set(app.html_themes.keys()) == set(themes) assert set(app.registry.html_themes.keys()) == set(themes)
assert app.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme' assert app.registry.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme'
assert app.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip' assert app.registry.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip'
assert app.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles' assert app.registry.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles'
# test Theme instance API # test Theme instance API
theme = app.builder.theme theme = app.builder.theme

View File

@ -1,8 +1,8 @@
import contextlib import contextlib
import http.server import http.server
import pathlib import pathlib
import ssl
import threading import threading
from ssl import PROTOCOL_TLS_SERVER, SSLContext
# Generated with: # Generated with:
# $ openssl req -new -x509 -days 3650 -nodes -out cert.pem \ # $ openssl req -new -x509 -days 3650 -nodes -out cert.pem \
@ -27,11 +27,9 @@ class HttpServerThread(threading.Thread):
class HttpsServerThread(HttpServerThread): class HttpsServerThread(HttpServerThread):
def __init__(self, handler, *args, **kwargs): def __init__(self, handler, *args, **kwargs):
super().__init__(handler, *args, **kwargs) super().__init__(handler, *args, **kwargs)
self.server.socket = ssl.wrap_socket( sslcontext = SSLContext(PROTOCOL_TLS_SERVER)
self.server.socket, sslcontext.load_cert_chain(CERT_FILE)
certfile=CERT_FILE, self.server.socket = sslcontext.wrap_socket(self.server.socket, server_side=True)
server_side=True,
)
def create_server(thread_class): def create_server(thread_class):