diff options
| author | Hai Shi <shihai1992@gmail.com> | 2020-10-16 16:34:15 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-16 10:34:15 +0200 |
| commit | c9f696cb96d1c362d5cad871f61da520572d9b08 (patch) | |
| tree | 4dbc6f4960f9058660751bd860589a6e9762ccc7 /Lib/test/test_io.py | |
| parent | cf693e537dc8aaa14315a7f59baec4a31d1167d3 (diff) | |
| download | cpython-git-c9f696cb96d1c362d5cad871f61da520572d9b08.tar.gz | |
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()
Diffstat (limited to 'Lib/test/test_io.py')
| -rw-r--r-- | Lib/test/test_io.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 85fac30e30..fbaea3aaec 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -2529,10 +2529,6 @@ class StatefulIncrementalDecoder(codecs.IncrementalDecoder): streamreader=None, streamwriter=None, incrementaldecoder=cls) -# Register the previous decoder for testing. -# Disabled by default, tests will enable it. -codecs.register(StatefulIncrementalDecoder.lookupTestDecoder) - class StatefulIncrementalDecoderTest(unittest.TestCase): """ @@ -2583,6 +2579,9 @@ class TextIOWrapperTest(unittest.TestCase): self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n" self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii") os_helper.unlink(os_helper.TESTFN) + codecs.register(StatefulIncrementalDecoder.lookupTestDecoder) + self.addCleanup(codecs.unregister, + StatefulIncrementalDecoder.lookupTestDecoder) def tearDown(self): os_helper.unlink(os_helper.TESTFN) |
