@@ -4042,19 +4042,18 @@ class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest):
40424042
40434043class MiscIOTest (unittest .TestCase ):
40444044
4045+ # for test__all__, actual values are set in subclasses
4046+ name_of_module = None
4047+ extra_exported = ()
4048+ not_exported = ()
4049+
40454050 def tearDown (self ):
40464051 os_helper .unlink (os_helper .TESTFN )
40474052
40484053 def test___all__ (self ):
4049- for name in self .io .__all__ :
4050- obj = getattr (self .io , name , None )
4051- self .assertIsNotNone (obj , name )
4052- if name in ("open" , "open_code" ):
4053- continue
4054- elif "error" in name .lower () or name == "UnsupportedOperation" :
4055- self .assertTrue (issubclass (obj , Exception ), name )
4056- elif not name .startswith ("SEEK_" ):
4057- self .assertTrue (issubclass (obj , self .IOBase ))
4054+ support .check__all__ (self , self .io , self .name_of_module ,
4055+ extra = self .extra_exported ,
4056+ not_exported = self .not_exported )
40584057
40594058 def test_attributes (self ):
40604059 f = self .open (os_helper .TESTFN , "wb" , buffering = 0 )
@@ -4416,6 +4415,8 @@ def test_text_encoding(self):
44164415
44174416class CMiscIOTest (MiscIOTest ):
44184417 io = io
4418+ name_of_module = "io" , "_io"
4419+ extra_exported = "BlockingIOError" ,
44194420
44204421 def test_readinto_buffer_overflow (self ):
44214422 # Issue #18025
@@ -4480,6 +4481,9 @@ def test_daemon_threads_shutdown_stderr_deadlock(self):
44804481
44814482class PyMiscIOTest (MiscIOTest ):
44824483 io = pyio
4484+ name_of_module = "_pyio" , "io"
4485+ extra_exported = "BlockingIOError" , "open_code" ,
4486+ not_exported = "valid_seek_flags" ,
44834487
44844488
44854489@unittest .skipIf (os .name == 'nt' , 'POSIX signals required for this test.' )
@@ -4767,7 +4771,7 @@ def load_tests(loader, tests, pattern):
47674771 mocks = (MockRawIO , MisbehavedRawIO , MockFileIO , CloseFailureIO ,
47684772 MockNonBlockWriterIO , MockUnseekableIO , MockRawIOWithoutRead ,
47694773 SlowFlushRawIO )
4770- all_members = io .__all__ + [ "IncrementalNewlineDecoder" ]
4774+ all_members = io .__all__
47714775 c_io_ns = {name : getattr (io , name ) for name in all_members }
47724776 py_io_ns = {name : getattr (pyio , name ) for name in all_members }
47734777 globs = globals ()
0 commit comments