summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-09-16 16:47:18 (GMT)
committerGitHub <noreply@github.com>2023-09-16 16:47:18 (GMT)
commite57ecf6bbc59f999d27b125ea51b042c24a07bd9 (patch)
treeeee25e43586f414e46daf2933678c435aa77de90
parent929cc4e4a0999b777e1aa94f9c007db720e67f43 (diff)
downloadcpython-e57ecf6bbc59f999d27b125ea51b042c24a07bd9.zip
cpython-e57ecf6bbc59f999d27b125ea51b042c24a07bd9.tar.gz
cpython-e57ecf6bbc59f999d27b125ea51b042c24a07bd9.tar.bz2
gh-108303: Move all certificates to `Lib/test/certdata/` (#109489)
-rw-r--r--Lib/test/certdata/allsans.pem (renamed from Lib/test/allsans.pem)0
-rw-r--r--Lib/test/certdata/badcert.pem (renamed from Lib/test/badcert.pem)0
-rw-r--r--Lib/test/certdata/badkey.pem (renamed from Lib/test/badkey.pem)0
-rw-r--r--Lib/test/certdata/capath/4e1295a3.0 (renamed from Lib/test/capath/4e1295a3.0)0
-rw-r--r--Lib/test/certdata/capath/5ed36f99.0 (renamed from Lib/test/capath/5ed36f99.0)0
-rw-r--r--Lib/test/certdata/capath/6e88d7b8.0 (renamed from Lib/test/capath/6e88d7b8.0)0
-rw-r--r--Lib/test/certdata/capath/99d0fa06.0 (renamed from Lib/test/capath/99d0fa06.0)0
-rw-r--r--Lib/test/certdata/capath/b1930218.0 (renamed from Lib/test/capath/b1930218.0)0
-rw-r--r--Lib/test/certdata/capath/ceff1710.0 (renamed from Lib/test/capath/ceff1710.0)0
-rw-r--r--Lib/test/certdata/ffdh3072.pem (renamed from Lib/test/ffdh3072.pem)0
-rw-r--r--Lib/test/certdata/idnsans.pem (renamed from Lib/test/idnsans.pem)0
-rw-r--r--Lib/test/certdata/keycert.passwd.pem (renamed from Lib/test/keycert.passwd.pem)0
-rw-r--r--Lib/test/certdata/keycert.pem (renamed from Lib/test/keycert.pem)0
-rw-r--r--Lib/test/certdata/keycert2.pem (renamed from Lib/test/keycert2.pem)0
-rw-r--r--Lib/test/certdata/keycert3.pem (renamed from Lib/test/keycert3.pem)0
-rw-r--r--Lib/test/certdata/keycert4.pem (renamed from Lib/test/keycert4.pem)0
-rw-r--r--Lib/test/certdata/keycertecc.pem (renamed from Lib/test/keycertecc.pem)0
-rw-r--r--Lib/test/certdata/make_ssl_certs.py (renamed from Lib/test/make_ssl_certs.py)0
-rw-r--r--Lib/test/certdata/nokia.pem (renamed from Lib/test/nokia.pem)0
-rw-r--r--Lib/test/certdata/nosan.pem (renamed from Lib/test/nosan.pem)0
-rw-r--r--Lib/test/certdata/nullbytecert.pem (renamed from Lib/test/nullbytecert.pem)0
-rw-r--r--Lib/test/certdata/nullcert.pem (renamed from Lib/test/nullcert.pem)0
-rw-r--r--Lib/test/certdata/pycacert.pem (renamed from Lib/test/pycacert.pem)0
-rw-r--r--Lib/test/certdata/pycakey.pem (renamed from Lib/test/pycakey.pem)0
-rw-r--r--Lib/test/certdata/revocation.crl (renamed from Lib/test/revocation.crl)0
-rw-r--r--Lib/test/certdata/secp384r1.pem (renamed from Lib/test/secp384r1.pem)0
-rw-r--r--Lib/test/certdata/selfsigned_pythontestdotnet.pem (renamed from Lib/test/selfsigned_pythontestdotnet.pem)0
-rw-r--r--Lib/test/certdata/ssl_cert.pem (renamed from Lib/test/ssl_cert.pem)0
-rw-r--r--Lib/test/certdata/ssl_key.passwd.pem (renamed from Lib/test/ssl_key.passwd.pem)0
-rw-r--r--Lib/test/certdata/ssl_key.pem (renamed from Lib/test/ssl_key.pem)0
-rw-r--r--Lib/test/certdata/talos-2019-0758.pem (renamed from Lib/test/talos-2019-0758.pem)0
-rw-r--r--Lib/test/ssl_servers.py2
-rw-r--r--Lib/test/test_asyncio/utils.py16
-rw-r--r--Lib/test/test_ftplib.py4
-rw-r--r--Lib/test/test_httplib.py8
-rw-r--r--Lib/test/test_imaplib.py4
-rw-r--r--Lib/test/test_logging.py2
-rw-r--r--Lib/test/test_poplib.py4
-rw-r--r--Lib/test/test_ssl.py12
-rw-r--r--Lib/test/test_urllib2_localnet.py4
-rw-r--r--Makefile.pre.in3
41 files changed, 31 insertions, 28 deletions
diff --git a/Lib/test/allsans.pem b/Lib/test/certdata/allsans.pem
index e400e17..e400e17 100644
--- a/Lib/test/allsans.pem
+++ b/Lib/test/certdata/allsans.pem
diff --git a/Lib/test/badcert.pem b/Lib/test/certdata/badcert.pem
index c419146..c419146 100644
--- a/Lib/test/badcert.pem
+++ b/Lib/test/certdata/badcert.pem
diff --git a/Lib/test/badkey.pem b/Lib/test/certdata/badkey.pem
index 1c8a955..1c8a955 100644
--- a/Lib/test/badkey.pem
+++ b/Lib/test/certdata/badkey.pem
diff --git a/Lib/test/capath/4e1295a3.0 b/Lib/test/certdata/capath/4e1295a3.0
index 9d7ac23..9d7ac23 100644
--- a/Lib/test/capath/4e1295a3.0
+++ b/Lib/test/certdata/capath/4e1295a3.0
diff --git a/Lib/test/capath/5ed36f99.0 b/Lib/test/certdata/capath/5ed36f99.0
index e7dfc82..e7dfc82 100644
--- a/Lib/test/capath/5ed36f99.0
+++ b/Lib/test/certdata/capath/5ed36f99.0
diff --git a/Lib/test/capath/6e88d7b8.0 b/Lib/test/certdata/capath/6e88d7b8.0
index 9d7ac23..9d7ac23 100644
--- a/Lib/test/capath/6e88d7b8.0
+++ b/Lib/test/certdata/capath/6e88d7b8.0
diff --git a/Lib/test/capath/99d0fa06.0 b/Lib/test/certdata/capath/99d0fa06.0
index e7dfc82..e7dfc82 100644
--- a/Lib/test/capath/99d0fa06.0
+++ b/Lib/test/certdata/capath/99d0fa06.0
diff --git a/Lib/test/capath/b1930218.0 b/Lib/test/certdata/capath/b1930218.0
index 941d791..941d791 100644
--- a/Lib/test/capath/b1930218.0
+++ b/Lib/test/certdata/capath/b1930218.0
diff --git a/Lib/test/capath/ceff1710.0 b/Lib/test/certdata/capath/ceff1710.0
index 941d791..941d791 100644
--- a/Lib/test/capath/ceff1710.0
+++ b/Lib/test/certdata/capath/ceff1710.0
diff --git a/Lib/test/ffdh3072.pem b/Lib/test/certdata/ffdh3072.pem
index ad69bac..ad69bac 100644
--- a/Lib/test/ffdh3072.pem
+++ b/Lib/test/certdata/ffdh3072.pem
diff --git a/Lib/test/idnsans.pem b/Lib/test/certdata/idnsans.pem
index cbcac78..cbcac78 100644
--- a/Lib/test/idnsans.pem
+++ b/Lib/test/certdata/idnsans.pem
diff --git a/Lib/test/keycert.passwd.pem b/Lib/test/certdata/keycert.passwd.pem
index c330c36..c330c36 100644
--- a/Lib/test/keycert.passwd.pem
+++ b/Lib/test/certdata/keycert.passwd.pem
diff --git a/Lib/test/keycert.pem b/Lib/test/certdata/keycert.pem
index 0d39863..0d39863 100644
--- a/Lib/test/keycert.pem
+++ b/Lib/test/certdata/keycert.pem
diff --git a/Lib/test/keycert2.pem b/Lib/test/certdata/keycert2.pem
index e59d454..e59d454 100644
--- a/Lib/test/keycert2.pem
+++ b/Lib/test/certdata/keycert2.pem
diff --git a/Lib/test/keycert3.pem b/Lib/test/certdata/keycert3.pem
index f6887ba..f6887ba 100644
--- a/Lib/test/keycert3.pem
+++ b/Lib/test/certdata/keycert3.pem
diff --git a/Lib/test/keycert4.pem b/Lib/test/certdata/keycert4.pem
index 1003d67..1003d67 100644
--- a/Lib/test/keycert4.pem
+++ b/Lib/test/certdata/keycert4.pem
diff --git a/Lib/test/keycertecc.pem b/Lib/test/certdata/keycertecc.pem
index 81daa4c..81daa4c 100644
--- a/Lib/test/keycertecc.pem
+++ b/Lib/test/certdata/keycertecc.pem
diff --git a/Lib/test/make_ssl_certs.py b/Lib/test/certdata/make_ssl_certs.py
index 94a35a6..94a35a6 100644
--- a/Lib/test/make_ssl_certs.py
+++ b/Lib/test/certdata/make_ssl_certs.py
diff --git a/Lib/test/nokia.pem b/Lib/test/certdata/nokia.pem
index 0d044df..0d044df 100644
--- a/Lib/test/nokia.pem
+++ b/Lib/test/certdata/nokia.pem
diff --git a/Lib/test/nosan.pem b/Lib/test/certdata/nosan.pem
index ec10cdc..ec10cdc 100644
--- a/Lib/test/nosan.pem
+++ b/Lib/test/certdata/nosan.pem
diff --git a/Lib/test/nullbytecert.pem b/Lib/test/certdata/nullbytecert.pem
index 447186c..447186c 100644
--- a/Lib/test/nullbytecert.pem
+++ b/Lib/test/certdata/nullbytecert.pem
diff --git a/Lib/test/nullcert.pem b/Lib/test/certdata/nullcert.pem
index e69de29..e69de29 100644
--- a/Lib/test/nullcert.pem
+++ b/Lib/test/certdata/nullcert.pem
diff --git a/Lib/test/pycacert.pem b/Lib/test/certdata/pycacert.pem
index 360cd57..360cd57 100644
--- a/Lib/test/pycacert.pem
+++ b/Lib/test/certdata/pycacert.pem
diff --git a/Lib/test/pycakey.pem b/Lib/test/certdata/pycakey.pem
index 819bdef..819bdef 100644
--- a/Lib/test/pycakey.pem
+++ b/Lib/test/certdata/pycakey.pem
diff --git a/Lib/test/revocation.crl b/Lib/test/certdata/revocation.crl
index 621675e..621675e 100644
--- a/Lib/test/revocation.crl
+++ b/Lib/test/certdata/revocation.crl
diff --git a/Lib/test/secp384r1.pem b/Lib/test/certdata/secp384r1.pem
index eef7117..eef7117 100644
--- a/Lib/test/secp384r1.pem
+++ b/Lib/test/certdata/secp384r1.pem
diff --git a/Lib/test/selfsigned_pythontestdotnet.pem b/Lib/test/certdata/selfsigned_pythontestdotnet.pem
index 2b17607..2b17607 100644
--- a/Lib/test/selfsigned_pythontestdotnet.pem
+++ b/Lib/test/certdata/selfsigned_pythontestdotnet.pem
diff --git a/Lib/test/ssl_cert.pem b/Lib/test/certdata/ssl_cert.pem
index de59671..de59671 100644
--- a/Lib/test/ssl_cert.pem
+++ b/Lib/test/certdata/ssl_cert.pem
diff --git a/Lib/test/ssl_key.passwd.pem b/Lib/test/certdata/ssl_key.passwd.pem
index 46de61a..46de61a 100644
--- a/Lib/test/ssl_key.passwd.pem
+++ b/Lib/test/certdata/ssl_key.passwd.pem
diff --git a/Lib/test/ssl_key.pem b/Lib/test/certdata/ssl_key.pem
index 1ea4578..1ea4578 100644
--- a/Lib/test/ssl_key.pem
+++ b/Lib/test/certdata/ssl_key.pem
diff --git a/Lib/test/talos-2019-0758.pem b/Lib/test/certdata/talos-2019-0758.pem
index 13b95a7..13b95a7 100644
--- a/Lib/test/talos-2019-0758.pem
+++ b/Lib/test/certdata/talos-2019-0758.pem
diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index a4bd745..15b071e 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -14,7 +14,7 @@ from test.support import socket_helper
here = os.path.dirname(__file__)
HOST = socket_helper.HOST
-CERTFILE = os.path.join(here, 'keycert.pem')
+CERTFILE = os.path.join(here, 'certdata', 'keycert.pem')
# This one's based on HTTPServer, which is based on socketserver
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 6dee5bb..64eb441 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -36,21 +36,21 @@ from test.support import socket_helper
from test.support import threading_helper
-def data_file(filename):
+def data_file(*filename):
if hasattr(support, 'TEST_HOME_DIR'):
- fullname = os.path.join(support.TEST_HOME_DIR, filename)
+ fullname = os.path.join(support.TEST_HOME_DIR, *filename)
if os.path.isfile(fullname):
return fullname
- fullname = os.path.join(os.path.dirname(__file__), '..', filename)
+ fullname = os.path.join(os.path.dirname(__file__), '..', *filename)
if os.path.isfile(fullname):
return fullname
- raise FileNotFoundError(filename)
+ raise FileNotFoundError(os.path.join(filename))
-ONLYCERT = data_file('ssl_cert.pem')
-ONLYKEY = data_file('ssl_key.pem')
-SIGNED_CERTFILE = data_file('keycert3.pem')
-SIGNING_CA = data_file('pycacert.pem')
+ONLYCERT = data_file('certdata', 'ssl_cert.pem')
+ONLYKEY = data_file('certdata', 'ssl_key.pem')
+SIGNED_CERTFILE = data_file('certdata', 'keycert3.pem')
+SIGNING_CA = data_file('certdata', 'pycacert.pem')
PEERCERT = {
'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
'caIssuers': ('http://testca.pythontest.net/testca/pycacert.cer',),
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 544228e..bebd1bb 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -325,8 +325,8 @@ class DummyFTPServer(asyncore.dispatcher, threading.Thread):
if ssl is not None:
- CERTFILE = os.path.join(os.path.dirname(__file__), "keycert3.pem")
- CAFILE = os.path.join(os.path.dirname(__file__), "pycacert.pem")
+ CERTFILE = os.path.join(os.path.dirname(__file__), "certdata", "keycert3.pem")
+ CAFILE = os.path.join(os.path.dirname(__file__), "certdata", "pycacert.pem")
class SSLConnection(asyncore.dispatcher):
"""An asyncore.dispatcher subclass supporting TLS/SSL."""
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 676725c..5d5832b 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -21,11 +21,13 @@ support.requires_working_socket(module=True)
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
-CERT_localhost = os.path.join(here, 'keycert.pem')
+CERT_localhost = os.path.join(here, 'certdata', 'keycert.pem')
# Self-signed cert file for 'fakehostname'
-CERT_fakehostname = os.path.join(here, 'keycert2.pem')
+CERT_fakehostname = os.path.join(here, 'certdata', 'keycert2.pem')
# Self-signed cert file for self-signed.pythontest.net
-CERT_selfsigned_pythontestdotnet = os.path.join(here, 'selfsigned_pythontestdotnet.pem')
+CERT_selfsigned_pythontestdotnet = os.path.join(
+ here, 'certdata', 'selfsigned_pythontestdotnet.pem',
+)
# constants for testing chunked encoding
chunked_start = (
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index a1eaf21..b97474a 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -23,8 +23,8 @@ except ImportError:
support.requires_working_socket(module=True)
-CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
-CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
+CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "certdata", "keycert3.pem")
+CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "certdata", "pycacert.pem")
class TestImaplib(unittest.TestCase):
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 2305e51..375f65f 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -2170,7 +2170,7 @@ class HTTPHandlerTest(BaseTest):
sslctx = None
else:
here = os.path.dirname(__file__)
- localhost_cert = os.path.join(here, "keycert.pem")
+ localhost_cert = os.path.join(here, "certdata", "keycert.pem")
sslctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
sslctx.load_cert_chain(localhost_cert)
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py
index fa41ba0..869f943 100644
--- a/Lib/test/test_poplib.py
+++ b/Lib/test/test_poplib.py
@@ -29,8 +29,8 @@ if hasattr(poplib, 'POP3_SSL'):
import ssl
SUPPORTS_SSL = True
- CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "keycert3.pem")
- CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "pycacert.pem")
+ CERTFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "certdata", "keycert3.pem")
+ CAFILE = os.path.join(os.path.dirname(__file__) or os.curdir, "certdata", "pycacert.pem")
requires_ssl = skipUnless(SUPPORTS_SSL, 'SSL not supported')
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 2c32fec..06304dc 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -60,10 +60,10 @@ for proto, ver in (
PROTOCOL_TO_TLS_VERSION[proto] = ver
def data_file(*name):
- return os.path.join(os.path.dirname(__file__), *name)
+ return os.path.join(os.path.dirname(__file__), "certdata", *name)
# The custom key and certificate files used in test_ssl are generated
-# using Lib/test/make_ssl_certs.py.
+# using Lib/test/certdata/make_ssl_certs.py.
# Other certificates are simply fetched from the internet servers they
# are meant to authenticate.
@@ -641,7 +641,7 @@ class BasicSocketTests(unittest.TestCase):
def bad_cert_test(self, certfile):
"""Check that trying to use the given client certificate fails"""
certfile = os.path.join(os.path.dirname(__file__) or os.curdir,
- certfile)
+ "certdata", certfile)
sock = socket.socket()
self.addCleanup(sock.close)
with self.assertRaises(ssl.SSLError):
@@ -3309,12 +3309,12 @@ class ThreadedTests(unittest.TestCase):
# try to connect
if support.verbose:
sys.stdout.write('\n')
- with open(CERTFILE, 'rb') as f:
+ # Get this test file itself:
+ with open(__file__, 'rb') as f:
d1 = f.read()
d2 = ''
# now fetch the same data from the HTTPS server
- url = 'https://localhost:%d/%s' % (
- server.port, os.path.split(CERTFILE)[1])
+ url = f'https://localhost:{server.port}/test_ssl.py'
context = ssl.create_default_context(cafile=SIGNING_CA)
f = urllib.request.urlopen(url, context=context)
try:
diff --git a/Lib/test/test_urllib2_localnet.py b/Lib/test/test_urllib2_localnet.py
index 0dcdbac..50c491a 100644
--- a/Lib/test/test_urllib2_localnet.py
+++ b/Lib/test/test_urllib2_localnet.py
@@ -21,9 +21,9 @@ support.requires_working_socket(module=True)
here = os.path.dirname(__file__)
# Self-signed cert file for 'localhost'
-CERT_localhost = os.path.join(here, 'keycert.pem')
+CERT_localhost = os.path.join(here, 'certdata', 'keycert.pem')
# Self-signed cert file for 'fakehostname'
-CERT_fakehostname = os.path.join(here, 'keycert2.pem')
+CERT_fakehostname = os.path.join(here, 'certdata', 'keycert2.pem')
# Loopback http server infrastructure
diff --git a/Makefile.pre.in b/Makefile.pre.in
index ba35e1b..35f2545 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -2141,7 +2141,8 @@ LIBSUBDIRS= asyncio \
TESTSUBDIRS= idlelib/idle_test \
test \
test/audiodata \
- test/capath \
+ test/certdata \
+ test/certdata/capath \
test/cjkencodings \
test/crashers \
test/data \