]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41521: Rename blacklist parameter to not_exported (GH-21824)
authorVictor Stinner <vstinner@python.org>
Mon, 17 Aug 2020 05:20:40 +0000 (07:20 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Aug 2020 05:20:40 +0000 (07:20 +0200)
Rename "blacklist" parameter of test.support.check__all__() to
"not_exported".

20 files changed:
Doc/library/test.rst
Lib/test/_test_multiprocessing.py
Lib/test/support/__init__.py
Lib/test/test_calendar.py
Lib/test/test_cgi.py
Lib/test/test_configparser.py
Lib/test/test_ftplib.py
Lib/test/test_gettext.py
Lib/test/test_logging.py
Lib/test/test_mailbox.py
Lib/test/test_optparse.py
Lib/test/test_pickletools.py
Lib/test/test_plistlib.py
Lib/test/test_smtpd.py
Lib/test/test_support.py
Lib/test/test_tarfile.py
Lib/test/test_threading.py
Lib/test/test_wave.py
Lib/test/test_xml_etree.py
Misc/NEWS.d/next/Tests/2020-08-11-14-59-13.bpo-41521.w2UYK7.rst [new file with mode: 0644]

index cd05ef07b4a21218309262d5f960f57b6fcdd1b4..6495b4844449e59fcd66a3ffc36e961020c47ddd 100644 (file)
@@ -878,7 +878,7 @@ The :mod:`test.support` module defines the following functions:
    missing.
 
 
-.. function:: check__all__(test_case, module, name_of_module=None, extra=(), blacklist=())
+.. function:: check__all__(test_case, module, name_of_module=None, extra=(), not_exported=())
 
    Assert that the ``__all__`` variable of *module* contains all public names.
 
@@ -895,8 +895,8 @@ The :mod:`test.support` module defines the following functions:
    detected as "public", like objects without a proper ``__module__``
    attribute. If provided, it will be added to the automatically detected ones.
 
-   The *blacklist* argument can be a set of names that must not be treated as part of
-   the public API even though their names indicate otherwise.
+   The *not_exported* argument can be a set of names that must not be treated
+   as part of the public API even though their names indicate otherwise.
 
    Example use::
 
@@ -912,10 +912,10 @@ The :mod:`test.support` module defines the following functions:
       class OtherTestCase(unittest.TestCase):
           def test__all__(self):
               extra = {'BAR_CONST', 'FOO_CONST'}
-              blacklist = {'baz'}  # Undocumented name.
+              not_exported = {'baz'}  # Undocumented name.
               # bar imports part of its API from _bar.
               support.check__all__(self, bar, ('bar', '_bar'),
-                                   extra=extra, blacklist=blacklist)
+                                   extra=extra, not_exported=not_exported)
 
    .. versionadded:: 3.6
 
index 58663c02002e94d23d959d0d85ccf58a7c604908..6a0e1016aff8d0391d8dbe701191a9311cb17804 100644 (file)
@@ -5581,9 +5581,11 @@ class TestSyncManagerTypes(unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        # Just make sure names in blacklist are excluded
+        # Just make sure names in not_exported are excluded
         support.check__all__(self, multiprocessing, extra=multiprocessing.__all__,
-                             blacklist=['SUBDEBUG', 'SUBWARNING'])
+                             not_exported=['SUBDEBUG', 'SUBWARNING'])
+
+
 #
 # Mixins
 #
index e9573d133521025a652fb4d36b82feb3ee1277d6..4ba749454c18735623305cd64606213b15f017fe 100644 (file)
@@ -1410,7 +1410,7 @@ def detect_api_mismatch(ref_api, other_api, *, ignore=()):
 
 
 def check__all__(test_case, module, name_of_module=None, extra=(),
-                 blacklist=()):
+                 not_exported=()):
     """Assert that the __all__ variable of 'module' contains all public names.
 
     The module's public names (its API) are detected automatically based on
@@ -1427,7 +1427,7 @@ def check__all__(test_case, module, name_of_module=None, extra=(),
     '__module__' attribute. If provided, it will be added to the
     automatically detected ones.
 
-    The 'blacklist' argument can be a set of names that must not be treated
+    The 'not_exported' argument can be a set of names that must not be treated
     as part of the public API even though their names indicate otherwise.
 
     Usage:
@@ -1443,10 +1443,10 @@ def check__all__(test_case, module, name_of_module=None, extra=(),
         class OtherTestCase(unittest.TestCase):
             def test__all__(self):
                 extra = {'BAR_CONST', 'FOO_CONST'}
-                blacklist = {'baz'}  # Undocumented name.
+                not_exported = {'baz'}  # Undocumented name.
                 # bar imports part of its API from _bar.
                 support.check__all__(self, bar, ('bar', '_bar'),
-                                     extra=extra, blacklist=blacklist)
+                                     extra=extra, not_exported=not_exported)
 
     """
 
@@ -1458,7 +1458,7 @@ def check__all__(test_case, module, name_of_module=None, extra=(),
     expected = set(extra)
 
     for name in dir(module):
-        if name.startswith('_') or name in blacklist:
+        if name.startswith('_') or name in not_exported:
             continue
         obj = getattr(module, name)
         if (getattr(obj, '__module__', None) in name_of_module or
index 7c7ec1c931aa4801728d998eec7436584288975e..c641e8c418318d7e87ed2baf3fe7416c1764273a 100644 (file)
@@ -934,12 +934,12 @@ class CommandLineTestCase(unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'mdays', 'January', 'February', 'EPOCH',
-                     'MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY',
-                     'SATURDAY', 'SUNDAY', 'different_locale', 'c',
-                     'prweek', 'week', 'format', 'formatstring', 'main',
-                     'monthlen', 'prevmonth', 'nextmonth'}
-        support.check__all__(self, calendar, blacklist=blacklist)
+        not_exported = {
+            'mdays', 'January', 'February', 'EPOCH', 'MONDAY', 'TUESDAY',
+            'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY',
+            'different_locale', 'c', 'prweek', 'week', 'format',
+            'formatstring', 'main', 'monthlen', 'prevmonth', 'nextmonth'}
+        support.check__all__(self, calendar, not_exported=not_exported)
 
 
 class TestSubClassingCase(unittest.TestCase):
index 101942de947fb461220cce6376828f43d3d19cdc..6b29759da44d01bc2abad8d73242b7d7bb1f660d 100644 (file)
@@ -553,9 +553,10 @@ this is the content of the fake file
             ("form-data", {"name": "files", "filename": 'fo"o;bar'}))
 
     def test_all(self):
-        blacklist = {"logfile", "logfp", "initlog", "dolog", "nolog",
-                     "closelog", "log", "maxlen", "valid_boundary"}
-        support.check__all__(self, cgi, blacklist=blacklist)
+        not_exported = {
+            "logfile", "logfp", "initlog", "dolog", "nolog", "closelog", "log",
+            "maxlen", "valid_boundary"}
+        support.check__all__(self, cgi, not_exported=not_exported)
 
 
 BOUNDARY = "---------------------------721837373350705526688164684"
index 230ffc1ccf81a79bb42dace8b2faeca09bee3439..80a9f179ee2bbcdadcdd7ca301f085341df1465e 100644 (file)
@@ -2128,8 +2128,7 @@ class BlatantOverrideConvertersTestCase(unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"Error"}
-        support.check__all__(self, configparser, blacklist=blacklist)
+        support.check__all__(self, configparser, not_exported={"Error"})
 
 
 if __name__ == '__main__':
index 65feb3aadedd672ab6dfa76fb20bdf5752362040..39658f22aa18c3280a0cf22f7dc98d7e4fc713d6 100644 (file)
@@ -1107,10 +1107,11 @@ class TestTimeouts(TestCase):
 
 class MiscTestCase(TestCase):
     def test__all__(self):
-        blacklist = {'MSG_OOB', 'FTP_PORT', 'MAXLINE', 'CRLF', 'B_CRLF',
-                     'Error', 'parse150', 'parse227', 'parse229', 'parse257',
-                     'print_line', 'ftpcp', 'test'}
-        support.check__all__(self, ftplib, blacklist=blacklist)
+        not_exported = {
+            'MSG_OOB', 'FTP_PORT', 'MAXLINE', 'CRLF', 'B_CRLF', 'Error',
+            'parse150', 'parse227', 'parse229', 'parse257', 'print_line',
+            'ftpcp', 'test'}
+        support.check__all__(self, ftplib, not_exported=not_exported)
 
 
 def test_main():
index df9eae39eac3e3ae55d902ffdab186c02a8bb0a5..575914d62a0bce80eece99f4f7887b9f7c070964 100644 (file)
@@ -820,8 +820,8 @@ class GettextCacheTestCase(GettextBaseTest):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'c2py', 'ENOENT'}
-        support.check__all__(self, gettext, blacklist=blacklist)
+        support.check__all__(self, gettext,
+                             not_exported={'c2py', 'ENOENT'})
 
 
 if __name__ == '__main__':
index d8b3727eb11851de220084751d2deb6610d24ba6..00a4825d6da88d493845ea2ee1c5de6b9f6d337a 100644 (file)
@@ -5363,12 +5363,12 @@ class NTEventLogHandlerTest(BaseTest):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'logThreads', 'logMultiprocessing',
-                     'logProcesses', 'currentframe',
-                     'PercentStyle', 'StrFormatStyle', 'StringTemplateStyle',
-                     'Filterer', 'PlaceHolder', 'Manager', 'RootLogger',
-                     'root', 'threading'}
-        support.check__all__(self, logging, blacklist=blacklist)
+        not_exported = {
+            'logThreads', 'logMultiprocessing', 'logProcesses', 'currentframe',
+            'PercentStyle', 'StrFormatStyle', 'StringTemplateStyle',
+            'Filterer', 'PlaceHolder', 'Manager', 'RootLogger', 'root',
+            'threading'}
+        support.check__all__(self, logging, not_exported=not_exported)
 
 
 # Set the locale to the platform-dependent default.  I have no idea
index 346c9f1c559cd50225e6bd1a23b31ba61dbae31a..5924f244f39f8be39cee58e1f9dfcb109c84658a 100644 (file)
@@ -2296,8 +2296,8 @@ Gregory K. Johnson
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"linesep", "fcntl"}
-        support.check__all__(self, mailbox, blacklist=blacklist)
+        support.check__all__(self, mailbox,
+                             not_exported={"linesep", "fcntl"})
 
 
 def test_main():
index ed65b7798e3d2abd402e58932e59d552440248dc..1ed6bf9f919a2c3fc2fbe204c744367d74537859 100644 (file)
@@ -1652,8 +1652,8 @@ class TestParseNumber(BaseTest):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'check_builtin', 'AmbiguousOptionError', 'NO_DEFAULT'}
-        support.check__all__(self, optparse, blacklist=blacklist)
+        not_exported = {'check_builtin', 'AmbiguousOptionError', 'NO_DEFAULT'}
+        support.check__all__(self, optparse, not_exported=not_exported)
 
 
 def test_main():
index 8cc6ca58cd04b43f793793054d99a2b87db4aafd..f5e9ae41c3c1a48c8d6c831d7aef86521803a4dd 100644 (file)
@@ -63,34 +63,35 @@ class OptimizedPickleTests(AbstractPickleTests):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'bytes_types',
-                     'UP_TO_NEWLINE', 'TAKEN_FROM_ARGUMENT1',
-                     'TAKEN_FROM_ARGUMENT4', 'TAKEN_FROM_ARGUMENT4U',
-                     'TAKEN_FROM_ARGUMENT8U', 'ArgumentDescriptor',
-                     'read_uint1', 'read_uint2', 'read_int4', 'read_uint4',
-                     'read_uint8', 'read_stringnl', 'read_stringnl_noescape',
-                     'read_stringnl_noescape_pair', 'read_string1',
-                     'read_string4', 'read_bytes1', 'read_bytes4',
-                     'read_bytes8', 'read_bytearray8', 'read_unicodestringnl',
-                     'read_unicodestring1', 'read_unicodestring4',
-                     'read_unicodestring8', 'read_decimalnl_short',
-                     'read_decimalnl_long', 'read_floatnl', 'read_float8',
-                     'read_long1', 'read_long4',
-                     'uint1', 'uint2', 'int4', 'uint4', 'uint8', 'stringnl',
-                     'stringnl_noescape', 'stringnl_noescape_pair', 'string1',
-                     'string4', 'bytes1', 'bytes4', 'bytes8', 'bytearray8',
-                     'unicodestringnl', 'unicodestring1', 'unicodestring4',
-                     'unicodestring8', 'decimalnl_short', 'decimalnl_long',
-                     'floatnl', 'float8', 'long1', 'long4',
-                     'StackObject',
-                     'pyint', 'pylong', 'pyinteger_or_bool', 'pybool', 'pyfloat',
-                     'pybytes_or_str', 'pystring', 'pybytes', 'pybytearray',
-                     'pyunicode', 'pynone', 'pytuple', 'pylist', 'pydict',
-                     'pyset', 'pyfrozenset', 'pybuffer', 'anyobject',
-                     'markobject', 'stackslice', 'OpcodeInfo', 'opcodes',
-                     'code2op',
-                     }
-        support.check__all__(self, pickletools, blacklist=blacklist)
+        not_exported = {
+            'bytes_types',
+            'UP_TO_NEWLINE', 'TAKEN_FROM_ARGUMENT1',
+            'TAKEN_FROM_ARGUMENT4', 'TAKEN_FROM_ARGUMENT4U',
+            'TAKEN_FROM_ARGUMENT8U', 'ArgumentDescriptor',
+            'read_uint1', 'read_uint2', 'read_int4', 'read_uint4',
+            'read_uint8', 'read_stringnl', 'read_stringnl_noescape',
+            'read_stringnl_noescape_pair', 'read_string1',
+            'read_string4', 'read_bytes1', 'read_bytes4',
+            'read_bytes8', 'read_bytearray8', 'read_unicodestringnl',
+            'read_unicodestring1', 'read_unicodestring4',
+            'read_unicodestring8', 'read_decimalnl_short',
+            'read_decimalnl_long', 'read_floatnl', 'read_float8',
+            'read_long1', 'read_long4',
+            'uint1', 'uint2', 'int4', 'uint4', 'uint8', 'stringnl',
+            'stringnl_noescape', 'stringnl_noescape_pair', 'string1',
+            'string4', 'bytes1', 'bytes4', 'bytes8', 'bytearray8',
+            'unicodestringnl', 'unicodestring1', 'unicodestring4',
+            'unicodestring8', 'decimalnl_short', 'decimalnl_long',
+            'floatnl', 'float8', 'long1', 'long4',
+            'StackObject',
+            'pyint', 'pylong', 'pyinteger_or_bool', 'pybool', 'pyfloat',
+            'pybytes_or_str', 'pystring', 'pybytes', 'pybytearray',
+            'pyunicode', 'pynone', 'pytuple', 'pylist', 'pydict',
+            'pyset', 'pyfrozenset', 'pybuffer', 'anyobject',
+            'markobject', 'stackslice', 'OpcodeInfo', 'opcodes',
+            'code2op',
+        }
+        support.check__all__(self, pickletools, not_exported=not_exported)
 
 
 def test_main():
index e5038d2e7f10a2cf9c0599177d27e503fa338bb5..e5c9b5b6b2cfea5ccfd47d595753477717e4926a 100644 (file)
@@ -672,8 +672,8 @@ class TestKeyedArchive(unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {"PlistFormat", "PLISTHEADER"}
-        support.check__all__(self, plistlib, blacklist=blacklist)
+        not_exported = {"PlistFormat", "PLISTHEADER"}
+        support.check__all__(self, plistlib, not_exported=not_exported)
 
 
 if __name__ == '__main__':
index d5d5abfcf370a8c323b495e26786bfb7dfd1844e..6303192d1b26cc33d2f3ee7ee74486149f0bb632 100644 (file)
@@ -1003,12 +1003,11 @@ class SMTPDChannelTestWithEnableSMTPUTF8True(unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {
+        not_exported = {
             "program", "Devnull", "DEBUGSTREAM", "NEWLINE", "COMMASPACE",
             "DATA_SIZE_DEFAULT", "usage", "Options", "parseargs",
-
         }
-        support.check__all__(self, smtpd, blacklist=blacklist)
+        support.check__all__(self, smtpd, not_exported=not_exported)
 
 
 if __name__ == "__main__":
index b268511844b82816207c22145f3ef97532e1ba18..71a66c27aa21df04fdc8bea7a9201cb693c8d7c0 100644 (file)
@@ -391,14 +391,14 @@ class TestSupport(unittest.TestCase):
 
     def test_check__all__(self):
         extra = {'tempdir'}
-        blacklist = {'template'}
+        not_exported = {'template'}
         support.check__all__(self,
                              tempfile,
                              extra=extra,
-                             blacklist=blacklist)
+                             not_exported=not_exported)
 
         extra = {'TextTestResult', 'installHandler'}
-        blacklist = {'load_tests', "TestProgram", "BaseTestSuite"}
+        not_exported = {'load_tests', "TestProgram", "BaseTestSuite"}
 
         support.check__all__(self,
                              unittest,
@@ -407,7 +407,7 @@ class TestSupport(unittest.TestCase):
                               "unittest.main", "unittest.runner",
                               "unittest.signals", "unittest.async_case"),
                              extra=extra,
-                             blacklist=blacklist)
+                             not_exported=not_exported)
 
         self.assertRaises(AssertionError, support.check__all__, self, unittest)
 
index 4bf7248767c4b90495b52ad045ed392462795012..4ef20db097163629848281566caf8f3349cc194f 100644 (file)
@@ -2257,22 +2257,19 @@ class MiscTest(unittest.TestCase):
             tarfile.itn(0x10000000000, 6, tarfile.GNU_FORMAT)
 
     def test__all__(self):
-        blacklist = {'version', 'grp', 'pwd', 'symlink_exception',
-                     'NUL', 'BLOCKSIZE', 'RECORDSIZE', 'GNU_MAGIC',
-                     'POSIX_MAGIC', 'LENGTH_NAME', 'LENGTH_LINK',
-                     'LENGTH_PREFIX', 'REGTYPE', 'AREGTYPE', 'LNKTYPE',
-                     'SYMTYPE', 'CHRTYPE', 'BLKTYPE', 'DIRTYPE', 'FIFOTYPE',
-                     'CONTTYPE', 'GNUTYPE_LONGNAME', 'GNUTYPE_LONGLINK',
-                     'GNUTYPE_SPARSE', 'XHDTYPE', 'XGLTYPE', 'SOLARIS_XHDTYPE',
-                     'SUPPORTED_TYPES', 'REGULAR_TYPES', 'GNU_TYPES',
-                     'PAX_FIELDS', 'PAX_NAME_FIELDS', 'PAX_NUMBER_FIELDS',
-                     'stn', 'nts', 'nti', 'itn', 'calc_chksums', 'copyfileobj',
-                     'filemode',
-                     'EmptyHeaderError', 'TruncatedHeaderError',
-                     'EOFHeaderError', 'InvalidHeaderError',
-                     'SubsequentHeaderError', 'ExFileObject',
-                     'main'}
-        support.check__all__(self, tarfile, blacklist=blacklist)
+        not_exported = {
+            'version', 'grp', 'pwd', 'symlink_exception', 'NUL', 'BLOCKSIZE',
+            'RECORDSIZE', 'GNU_MAGIC', 'POSIX_MAGIC', 'LENGTH_NAME',
+            'LENGTH_LINK', 'LENGTH_PREFIX', 'REGTYPE', 'AREGTYPE', 'LNKTYPE',
+            'SYMTYPE', 'CHRTYPE', 'BLKTYPE', 'DIRTYPE', 'FIFOTYPE', 'CONTTYPE',
+            'GNUTYPE_LONGNAME', 'GNUTYPE_LONGLINK', 'GNUTYPE_SPARSE',
+            'XHDTYPE', 'XGLTYPE', 'SOLARIS_XHDTYPE', 'SUPPORTED_TYPES',
+            'REGULAR_TYPES', 'GNU_TYPES', 'PAX_FIELDS', 'PAX_NAME_FIELDS',
+            'PAX_NUMBER_FIELDS', 'stn', 'nts', 'nti', 'itn', 'calc_chksums',
+            'copyfileobj', 'filemode', 'EmptyHeaderError',
+            'TruncatedHeaderError', 'EOFHeaderError', 'InvalidHeaderError',
+            'SubsequentHeaderError', 'ExFileObject', 'main'}
+        support.check__all__(self, tarfile, not_exported=not_exported)
 
 
 class CommandLineTest(unittest.TestCase):
index 47e131ae27a148f5171ada66a33a1245136daae5..d02d3b346f9cc8e28bed16690c567c91a8c7fc86 100644 (file)
@@ -1365,9 +1365,9 @@ class BarrierTests(lock_tests.BarrierTests):
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
         extra = {"ThreadError"}
-        blacklist = {'currentThread', 'activeCount'}
+        not_exported = {'currentThread', 'activeCount'}
         support.check__all__(self, threading, ('threading', '_thread'),
-                             extra=extra, blacklist=blacklist)
+                             extra=extra, not_exported=not_exported)
 
 
 class InterruptMainTests(unittest.TestCase):
index eb231cb19c6d0a841a071e7d99298c41b7ccb384..f85e40b31d0100f440cd64625cc868922b3a4403 100644 (file)
@@ -107,8 +107,7 @@ class WavePCM32Test(WaveTest, unittest.TestCase):
 
 class MiscTestCase(unittest.TestCase):
     def test__all__(self):
-        blacklist = {'WAVE_FORMAT_PCM'}
-        support.check__all__(self, wave, blacklist=blacklist)
+        support.check__all__(self, wave, not_exported={'WAVE_FORMAT_PCM'})
 
 
 class WaveLowLevelTest(unittest.TestCase):
index c7d446185cfe4e7298075f37e751a7b8aea57c62..d22c35d92c4e3309c2ed40dd5498e7f24a63768f 100644 (file)
@@ -128,7 +128,7 @@ class ModuleTest(unittest.TestCase):
 
     def test_all(self):
         names = ("xml.etree.ElementTree", "_elementtree")
-        support.check__all__(self, ET, names, blacklist=("HTML_EMPTY",))
+        support.check__all__(self, ET, names, not_exported=("HTML_EMPTY",))
 
 
 def serialize(elem, to_string=True, encoding='unicode', **options):
diff --git a/Misc/NEWS.d/next/Tests/2020-08-11-14-59-13.bpo-41521.w2UYK7.rst b/Misc/NEWS.d/next/Tests/2020-08-11-14-59-13.bpo-41521.w2UYK7.rst
new file mode 100644 (file)
index 0000000..658372b
--- /dev/null
@@ -0,0 +1,2 @@
+:mod:`test.support`: Rename ``blacklist`` parameter of
+:func:`~test.support.check__all__` to ``not_exported``.