Skip to content

Commit 38bed78

Browse files
authored
[3.7] bpo-35352: test_asyncio uses the certificate set from the test directory (GH-10826) (GH-10834)
* bpo-35352: test_asyncio uses the certificate set from the test directory (GH-10826) Modify asyncio tests to utilize the certificates from the test directory instead of its own set, as they are the same and with each update they had to be updated as well. (cherry picked from commit b062ba7) * bpo-35352: Cleanup test_asyncio/utils.py (GH-10831) 'here' variable is no longer needed. (cherry picked from commit 7212148)
1 parent b135535 commit 38bed78

6 files changed

Lines changed: 3 additions & 190 deletions

File tree

Lib/test/test_asyncio/keycert3.pem

Lines changed: 0 additions & 73 deletions
This file was deleted.

Lib/test/test_asyncio/pycacert.pem

Lines changed: 0 additions & 78 deletions
This file was deleted.

Lib/test/test_asyncio/ssl_cert.pem

Lines changed: 0 additions & 15 deletions
This file was deleted.

Lib/test/test_asyncio/ssl_key.pem

Lines changed: 0 additions & 16 deletions
This file was deleted.

Lib/test/test_asyncio/utils.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def data_file(filename):
4040
fullname = os.path.join(support.TEST_HOME_DIR, filename)
4141
if os.path.isfile(fullname):
4242
return fullname
43-
fullname = os.path.join(os.path.dirname(__file__), filename)
43+
fullname = os.path.join(os.path.dirname(__file__), '..', filename)
4444
if os.path.isfile(fullname):
4545
return fullname
4646
raise FileNotFoundError(filename)
@@ -156,14 +156,8 @@ def finish_request(self, request, client_address):
156156
# contains the ssl key and certificate files) differs
157157
# between the stdlib and stand-alone asyncio.
158158
# Prefer our own if we can find it.
159-
here = os.path.join(os.path.dirname(__file__), '..', 'tests')
160-
if not os.path.isdir(here):
161-
here = os.path.join(os.path.dirname(os.__file__),
162-
'test', 'test_asyncio')
163-
keyfile = os.path.join(here, 'ssl_key.pem')
164-
certfile = os.path.join(here, 'ssl_cert.pem')
165159
context = ssl.SSLContext()
166-
context.load_cert_chain(certfile, keyfile)
160+
context.load_cert_chain(ONLYCERT, ONLYKEY)
167161

168162
ssock = context.wrap_socket(request, server_side=True)
169163
try:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Modify test_asyncio to use the certificate set from the test directory.

0 commit comments

Comments
 (0)