diff options
| author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2021-12-16 01:38:32 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-12-16 01:38:32 +0900 |
| commit | 3626c75de007a488b03aa105cccda1358059a4d0 (patch) | |
| tree | 3957d79930de1230161e08b7ef4e4fdf8f6a5ec7 | |
| parent | e2b6d078c124a8197c3bb69f727a6d17e90e9f22 (diff) | |
| parent | dcfc3f60ece50bf478791d644790ea26519bb150 (diff) | |
| download | sphinx-git-3626c75de007a488b03aa105cccda1358059a4d0.tar.gz | |
Merge pull request #9957 from tk0miya/refactor_DeprecationWarnings
Reduce DeprecationWarnings
| -rw-r--r-- | tests/test_theming.py | 8 | ||||
| -rw-r--r-- | tests/utils.py | 10 |
2 files changed, 8 insertions, 10 deletions
diff --git a/tests/test_theming.py b/tests/test_theming.py index 4b4c5ca9d..e98d4071b 100644 --- a/tests/test_theming.py +++ b/tests/test_theming.py @@ -30,10 +30,10 @@ def test_theme_api(app, status, warning): themes.append('alabaster') # test Theme class API - assert set(app.html_themes.keys()) == set(themes) - assert app.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme' - assert app.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip' - assert app.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles' + assert set(app.registry.html_themes.keys()) == set(themes) + assert app.registry.html_themes['test-theme'] == app.srcdir / 'test_theme' / 'test-theme' + assert app.registry.html_themes['ziptheme'] == app.srcdir / 'ziptheme.zip' + assert app.registry.html_themes['staticfiles'] == app.srcdir / 'test_theme' / 'staticfiles' # test Theme instance API theme = app.builder.theme diff --git a/tests/utils.py b/tests/utils.py index 9430c9beb..1f7cbb05a 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,8 +1,8 @@ import contextlib import http.server import pathlib -import ssl import threading +from ssl import PROTOCOL_TLS_SERVER, SSLContext # Generated with: # $ openssl req -new -x509 -days 3650 -nodes -out cert.pem \ @@ -27,11 +27,9 @@ class HttpServerThread(threading.Thread): class HttpsServerThread(HttpServerThread): def __init__(self, handler, *args, **kwargs): super().__init__(handler, *args, **kwargs) - self.server.socket = ssl.wrap_socket( - self.server.socket, - certfile=CERT_FILE, - server_side=True, - ) + sslcontext = SSLContext(PROTOCOL_TLS_SERVER) + sslcontext.load_cert_chain(CERT_FILE) + self.server.socket = sslcontext.wrap_socket(self.server.socket, server_side=True) def create_server(thread_class): |
