bpo-41919, test_codecs: Move codecs.register calls to setUp() (GH-22513)

* Move the codecs' (un)register operation to testcases.
* Remove _codecs._forget_codec() and _PyCodec_Forget()
This commit is contained in:
Hai Shi 2020-10-16 16:34:15 +08:00 committed by GitHub
parent cf693e537d
commit c9f696cb96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 16 additions and 112 deletions

View file

@ -36,7 +36,6 @@ def search_function(encoding):
return (encode2, decode2, None, None)
else:
return None
codecs.register(search_function)
def duplicate_string(text):
"""
@ -58,6 +57,10 @@ class UnicodeTest(string_tests.CommonTest,
type2test = str
def setUp(self):
codecs.register(search_function)
self.addCleanup(codecs.unregister, search_function)
def checkequalnofix(self, result, object, methodname, *args):
method = getattr(object, methodname)
realresult = method(*args)