diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 63f65a9c5cf47a..6f80968d575b07 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -1684,6 +1684,9 @@ class CommandLineRunTimeTestCase(unittest.TestCase): def setUp(self): super().setUp() + # fetch_file() calls urlopen() without an SSL context for the plain + # HTTP cases, which installs a process-wide default opener. + self.addCleanup(urllib.request.urlcleanup) server_dir_context = os_helper.temp_cwd() server_dir = self.enterContext(server_dir_context) with open(self.served_filename, 'wb') as f: