|
3 | 3 | if __name__ != 'test.support':
|
4 | 4 | raise ImportError('support must be imported from the test package')
|
5 | 5 |
|
6 |
| -import asyncio.events |
| 6 | +# import asyncio.events |
7 | 7 | import collections.abc
|
8 | 8 | import contextlib
|
9 | 9 | import datetime
|
10 | 10 | import errno
|
11 |
| -import faulthandler |
| 11 | +# import faulthandler |
12 | 12 | import fnmatch
|
13 | 13 | import functools
|
14 |
| -import gc |
| 14 | +# import gc |
15 | 15 | import importlib
|
16 | 16 | import importlib.util
|
17 | 17 | import io
|
18 |
| -import logging.handlers |
19 |
| -import nntplib |
| 18 | +# import logging.handlers |
| 19 | +# import nntplib |
20 | 20 | import os
|
21 | 21 | import platform
|
22 | 22 | import re
|
|
27 | 27 | import subprocess
|
28 | 28 | import sys
|
29 | 29 | import sysconfig
|
30 |
| -import tempfile |
| 30 | +# import tempfile |
31 | 31 | import _thread
|
32 |
| -import threading |
| 32 | +# import threading |
33 | 33 | import time
|
34 | 34 | import types
|
35 | 35 | import unittest
|
36 |
| -import urllib.error |
| 36 | +# import urllib.error |
37 | 37 | import warnings
|
38 | 38 |
|
39 | 39 | from .testresult import get_test_runner
|
@@ -757,22 +757,22 @@ def bind_unix_socket(sock, addr):
|
757 | 757 | sock.close()
|
758 | 758 | raise unittest.SkipTest('cannot bind AF_UNIX sockets')
|
759 | 759 |
|
760 |
| -def _is_ipv6_enabled(): |
761 |
| - """Check whether IPv6 is enabled on this host.""" |
762 |
| - if socket.has_ipv6: |
763 |
| - sock = None |
764 |
| - try: |
765 |
| - sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
766 |
| - sock.bind((HOSTv6, 0)) |
767 |
| - return True |
768 |
| - except OSError: |
769 |
| - pass |
770 |
| - finally: |
771 |
| - if sock: |
772 |
| - sock.close() |
773 |
| - return False |
774 |
| - |
775 |
| -IPV6_ENABLED = _is_ipv6_enabled() |
| 760 | +# def _is_ipv6_enabled(): |
| 761 | +# """Check whether IPv6 is enabled on this host.""" |
| 762 | +# if socket.has_ipv6: |
| 763 | +# sock = None |
| 764 | +# try: |
| 765 | +# sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
| 766 | +# sock.bind((HOSTv6, 0)) |
| 767 | +# return True |
| 768 | +# except OSError: |
| 769 | +# pass |
| 770 | +# finally: |
| 771 | +# if sock: |
| 772 | +# sock.close() |
| 773 | +# return False |
| 774 | + |
| 775 | +# IPV6_ENABLED = _is_ipv6_enabled() |
776 | 776 |
|
777 | 777 | def system_must_validate_cert(f):
|
778 | 778 | """Skip the test on TLS certificate validation failures."""
|
@@ -801,10 +801,10 @@ def dec(*args, **kwargs):
|
801 | 801 | # for a discussion of this number).
|
802 | 802 | SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1
|
803 | 803 |
|
804 |
| -# decorator for skipping tests on non-IEEE 754 platforms |
805 |
| -requires_IEEE_754 = unittest.skipUnless( |
806 |
| - float.__getformat__("double").startswith("IEEE"), |
807 |
| - "test requires IEEE 754 doubles") |
| 804 | +# # decorator for skipping tests on non-IEEE 754 platforms |
| 805 | +# requires_IEEE_754 = unittest.skipUnless( |
| 806 | +# float.__getformat__("double").startswith("IEEE"), |
| 807 | +# "test requires IEEE 754 doubles") |
808 | 808 |
|
809 | 809 | requires_zlib = unittest.skipUnless(zlib, 'requires zlib')
|
810 | 810 |
|
@@ -929,35 +929,35 @@ def dec(*args, **kwargs):
|
929 | 929 | # the byte 0xff. Skip some unicode filename tests.
|
930 | 930 | pass
|
931 | 931 |
|
932 |
| -# TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be |
933 |
| -# decoded from the filesystem encoding (in strict mode). It can be None if we |
934 |
| -# cannot generate such filename (ex: the latin1 encoding can decode any byte |
935 |
| -# sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks |
936 |
| -# to the surrogateescape error handler (PEP 383), but not from the filesystem |
937 |
| -# encoding in strict mode. |
938 |
| -TESTFN_UNDECODABLE = None |
939 |
| -for name in ( |
940 |
| - # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows |
941 |
| - # accepts it to create a file or a directory, or don't accept to enter to |
942 |
| - # such directory (when the bytes name is used). So test b'\xe7' first: it is |
943 |
| - # not decodable from cp932. |
944 |
| - b'\xe7w\xf0', |
945 |
| - # undecodable from ASCII, UTF-8 |
946 |
| - b'\xff', |
947 |
| - # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856 |
948 |
| - # and cp857 |
949 |
| - b'\xae\xd5' |
950 |
| - # undecodable from UTF-8 (UNIX and Mac OS X) |
951 |
| - b'\xed\xb2\x80', b'\xed\xb4\x80', |
952 |
| - # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252, |
953 |
| - # cp1253, cp1254, cp1255, cp1257, cp1258 |
954 |
| - b'\x81\x98', |
955 |
| -): |
956 |
| - try: |
957 |
| - name.decode(TESTFN_ENCODING) |
958 |
| - except UnicodeDecodeError: |
959 |
| - TESTFN_UNDECODABLE = os.fsencode(TESTFN) + name |
960 |
| - break |
| 932 | +# # TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be |
| 933 | +# # decoded from the filesystem encoding (in strict mode). It can be None if we |
| 934 | +# # cannot generate such filename (ex: the latin1 encoding can decode any byte |
| 935 | +# # sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks |
| 936 | +# # to the surrogateescape error handler (PEP 383), but not from the filesystem |
| 937 | +# # encoding in strict mode. |
| 938 | +# TESTFN_UNDECODABLE = None |
| 939 | +# for name in ( |
| 940 | +# # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows |
| 941 | +# # accepts it to create a file or a directory, or don't accept to enter to |
| 942 | +# # such directory (when the bytes name is used). So test b'\xe7' first: it is |
| 943 | +# # not decodable from cp932. |
| 944 | +# b'\xe7w\xf0', |
| 945 | +# # undecodable from ASCII, UTF-8 |
| 946 | +# b'\xff', |
| 947 | +# # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856 |
| 948 | +# # and cp857 |
| 949 | +# b'\xae\xd5' |
| 950 | +# # undecodable from UTF-8 (UNIX and Mac OS X) |
| 951 | +# b'\xed\xb2\x80', b'\xed\xb4\x80', |
| 952 | +# # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252, |
| 953 | +# # cp1253, cp1254, cp1255, cp1257, cp1258 |
| 954 | +# b'\x81\x98', |
| 955 | +# ): |
| 956 | +# try: |
| 957 | +# name.decode(TESTFN_ENCODING) |
| 958 | +# except UnicodeDecodeError: |
| 959 | +# TESTFN_UNDECODABLE = os.fsencode(TESTFN) + name |
| 960 | +# break |
961 | 961 |
|
962 | 962 | if FS_NONASCII:
|
963 | 963 | TESTFN_NONASCII = TESTFN + '-' + FS_NONASCII
|
@@ -2414,33 +2414,33 @@ def optim_args_from_interpreter_flags():
|
2414 | 2414 | # Support for assertions about logging.
|
2415 | 2415 | #============================================================
|
2416 | 2416 |
|
2417 |
| -class TestHandler(logging.handlers.BufferingHandler): |
2418 |
| - def __init__(self, matcher): |
2419 |
| - # BufferingHandler takes a "capacity" argument |
2420 |
| - # so as to know when to flush. As we're overriding |
2421 |
| - # shouldFlush anyway, we can set a capacity of zero. |
2422 |
| - # You can call flush() manually to clear out the |
2423 |
| - # buffer. |
2424 |
| - logging.handlers.BufferingHandler.__init__(self, 0) |
2425 |
| - self.matcher = matcher |
2426 |
| - |
2427 |
| - def shouldFlush(self): |
2428 |
| - return False |
2429 |
| - |
2430 |
| - def emit(self, record): |
2431 |
| - self.format(record) |
2432 |
| - self.buffer.append(record.__dict__) |
2433 |
| - |
2434 |
| - def matches(self, **kwargs): |
2435 |
| - """ |
2436 |
| - Look for a saved dict whose keys/values match the supplied arguments. |
2437 |
| - """ |
2438 |
| - result = False |
2439 |
| - for d in self.buffer: |
2440 |
| - if self.matcher.matches(d, **kwargs): |
2441 |
| - result = True |
2442 |
| - break |
2443 |
| - return result |
| 2417 | +# class TestHandler(logging.handlers.BufferingHandler): |
| 2418 | +# def __init__(self, matcher): |
| 2419 | +# # BufferingHandler takes a "capacity" argument |
| 2420 | +# # so as to know when to flush. As we're overriding |
| 2421 | +# # shouldFlush anyway, we can set a capacity of zero. |
| 2422 | +# # You can call flush() manually to clear out the |
| 2423 | +# # buffer. |
| 2424 | +# logging.handlers.BufferingHandler.__init__(self, 0) |
| 2425 | +# self.matcher = matcher |
| 2426 | + |
| 2427 | +# def shouldFlush(self): |
| 2428 | +# return False |
| 2429 | + |
| 2430 | +# def emit(self, record): |
| 2431 | +# self.format(record) |
| 2432 | +# self.buffer.append(record.__dict__) |
| 2433 | + |
| 2434 | +# def matches(self, **kwargs): |
| 2435 | +# """ |
| 2436 | +# Look for a saved dict whose keys/values match the supplied arguments. |
| 2437 | +# """ |
| 2438 | +# result = False |
| 2439 | +# for d in self.buffer: |
| 2440 | +# if self.matcher.matches(d, **kwargs): |
| 2441 | +# result = True |
| 2442 | +# break |
| 2443 | +# return result |
2444 | 2444 |
|
2445 | 2445 | class Matcher(object):
|
2446 | 2446 |
|
@@ -2794,23 +2794,23 @@ def run_in_subinterp(code):
|
2794 | 2794 | return _testcapi.run_in_subinterp(code)
|
2795 | 2795 |
|
2796 | 2796 |
|
2797 |
| -def check_free_after_iterating(test, iter, cls, args=()): |
2798 |
| - class A(cls): |
2799 |
| - def __del__(self): |
2800 |
| - nonlocal done |
2801 |
| - done = True |
2802 |
| - try: |
2803 |
| - next(it) |
2804 |
| - except StopIteration: |
2805 |
| - pass |
| 2797 | +# def check_free_after_iterating(test, iter, cls, args=()): |
| 2798 | +# class A(cls): |
| 2799 | +# def __del__(self): |
| 2800 | +# nonlocal done |
| 2801 | +# done = True |
| 2802 | +# try: |
| 2803 | +# next(it) |
| 2804 | +# except StopIteration: |
| 2805 | +# pass |
2806 | 2806 |
|
2807 |
| - done = False |
2808 |
| - it = iter(A(*args)) |
2809 |
| - # Issue 26494: Shouldn't crash |
2810 |
| - test.assertRaises(StopIteration, next, it) |
2811 |
| - # The sequence should be deallocated just after the end of iterating |
2812 |
| - gc_collect() |
2813 |
| - test.assertTrue(done) |
| 2807 | +# done = False |
| 2808 | +# it = iter(A(*args)) |
| 2809 | +# # Issue 26494: Shouldn't crash |
| 2810 | +# test.assertRaises(StopIteration, next, it) |
| 2811 | +# # The sequence should be deallocated just after the end of iterating |
| 2812 | +# gc_collect() |
| 2813 | +# test.assertTrue(done) |
2814 | 2814 |
|
2815 | 2815 |
|
2816 | 2816 | def missing_compiler_executable(cmd_names=[]):
|
@@ -2994,9 +2994,9 @@ def maybe_get_event_loop_policy():
|
2994 | 2994 | """Return the global event loop policy if one is set, else return None."""
|
2995 | 2995 | return asyncio.events._event_loop_policy
|
2996 | 2996 |
|
2997 |
| -# Helpers for testing hashing. |
2998 |
| -NHASHBITS = sys.hash_info.width # number of bits in hash() result |
2999 |
| -assert NHASHBITS in (32, 64) |
| 2997 | +# # Helpers for testing hashing. |
| 2998 | +# NHASHBITS = sys.hash_info.width # number of bits in hash() result |
| 2999 | +# assert NHASHBITS in (32, 64) |
3000 | 3000 |
|
3001 | 3001 | # Return mean and sdev of number of collisions when tossing nballs balls
|
3002 | 3002 | # uniformly at random into nbins bins. By definition, the number of
|
|
0 commit comments