@@ -3949,19 +3949,18 @@ class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest):
39493949
39503950class MiscIOTest (unittest .TestCase ):
39513951
3952+ # for test__all__, actual values are set in subclasses
3953+ name_of_module = None
3954+ extra_exported = ()
3955+ not_exported = ()
3956+
39523957 def tearDown (self ):
39533958 os_helper .unlink (os_helper .TESTFN )
39543959
39553960 def test___all__ (self ):
3956- for name in self .io .__all__ :
3957- obj = getattr (self .io , name , None )
3958- self .assertIsNotNone (obj , name )
3959- if name in ("open" , "open_code" ):
3960- continue
3961- elif "error" in name .lower () or name == "UnsupportedOperation" :
3962- self .assertTrue (issubclass (obj , Exception ), name )
3963- elif not name .startswith ("SEEK_" ):
3964- self .assertTrue (issubclass (obj , self .IOBase ))
3961+ support .check__all__ (self , self .io , self .name_of_module ,
3962+ extra = self .extra_exported ,
3963+ not_exported = self .not_exported )
39653964
39663965 def test_attributes (self ):
39673966 f = self .open (os_helper .TESTFN , "wb" , buffering = 0 )
@@ -4328,6 +4327,8 @@ def test_openwrapper(self):
43284327
43294328class CMiscIOTest (MiscIOTest ):
43304329 io = io
4330+ name_of_module = "io" , "_io"
4331+ extra_exported = "BlockingIOError" ,
43314332
43324333 def test_readinto_buffer_overflow (self ):
43334334 # Issue #18025
@@ -4392,6 +4393,9 @@ def test_daemon_threads_shutdown_stderr_deadlock(self):
43924393
43934394class PyMiscIOTest (MiscIOTest ):
43944395 io = pyio
4396+ name_of_module = "_pyio" , "io"
4397+ extra_exported = "BlockingIOError" , "open_code" ,
4398+ not_exported = "valid_seek_flags" ,
43954399
43964400
43974401@unittest .skipIf (os .name == 'nt' , 'POSIX signals required for this test.' )
@@ -4679,7 +4683,7 @@ def load_tests(loader, tests, pattern):
46794683 mocks = (MockRawIO , MisbehavedRawIO , MockFileIO , CloseFailureIO ,
46804684 MockNonBlockWriterIO , MockUnseekableIO , MockRawIOWithoutRead ,
46814685 SlowFlushRawIO )
4682- all_members = io .__all__ + [ "IncrementalNewlineDecoder" ]
4686+ all_members = io .__all__
46834687 c_io_ns = {name : getattr (io , name ) for name in all_members }
46844688 py_io_ns = {name : getattr (pyio , name ) for name in all_members }
46854689 globs = globals ()
0 commit comments