@@ -3751,9 +3751,7 @@ def test_shared_memory_SharedMemoryManager_basics(self):
37513751
37523752 with shared_memory .SharedMemoryManager () as smm2 :
37533753 sl = smm2 .ShareableList ("howdy" )
3754- unnecessary_lock = smm2 .Lock ()
3755- with unnecessary_lock :
3756- shm = smm2 .SharedMemory (size = 128 )
3754+ shm = smm2 .SharedMemory (size = 128 )
37573755 held_name = sl .shm .name
37583756 if sys .platform != "win32" :
37593757 with self .assertRaises (FileNotFoundError ):
@@ -4944,9 +4942,29 @@ def is_alive(self):
49444942 any (process .is_alive () for process in forked_processes ))
49454943
49464944
4947- class _MixinTestCommonManagerTypes (object ):
4945+ class TestSyncManagerTypes (unittest .TestCase ):
4946+ """Test all the types which can be shared between a parent and a
4947+ child process by using a manager which acts as an intermediary
4948+ between them.
4949+
4950+ In the following unit-tests the base type is created in the parent
4951+ process, the @classmethod represents the worker process and the
4952+ shared object is readable and editable between the two.
4953+
4954+ # The child.
4955+ @classmethod
4956+ def _test_list(cls, obj):
4957+ assert obj[0] == 5
4958+ assert obj.append(6)
49484959
4949- manager_class = None
4960+ # The parent.
4961+ def test_list(self):
4962+ o = self.manager.list()
4963+ o.append(5)
4964+ self.run_worker(self._test_list, o)
4965+ assert o[1] == 6
4966+ """
4967+ manager_class = multiprocessing .managers .SyncManager
49504968
49514969 def setUp (self ):
49524970 self .manager = self .manager_class ()
@@ -5056,31 +5074,6 @@ def test_barrier(self):
50565074 o = self .manager .Barrier (5 )
50575075 self .run_worker (self ._test_barrier , o )
50585076
5059-
5060- class TestSyncManagerTypes (_MixinTestCommonManagerTypes , unittest .TestCase ):
5061- """Test all the types which can be shared between a parent and a
5062- child process by using a manager which acts as an intermediary
5063- between them.
5064-
5065- In the following unit-tests the base type is created in the parent
5066- process, the @classmethod represents the worker process and the
5067- shared object is readable and editable between the two.
5068-
5069- # The child.
5070- @classmethod
5071- def _test_list(cls, obj):
5072- assert obj[0] == 5
5073- assert obj.append(6)
5074-
5075- # The parent.
5076- def test_list(self):
5077- o = self.manager.list()
5078- o.append(5)
5079- self.run_worker(self._test_list, o)
5080- assert o[1] == 6
5081- """
5082- manager_class = multiprocessing .managers .SyncManager
5083-
50845077 @classmethod
50855078 def _test_pool (cls , obj ):
50865079 # TODO: fix https://bugs.python.org/issue35919
@@ -5186,20 +5179,6 @@ def test_namespace(self):
51865179 self .run_worker (self ._test_namespace , o )
51875180
51885181
5189- try :
5190- import multiprocessing .shared_memory
5191- except ImportError :
5192- @unittest .skip ("SharedMemoryManager not available on this platform" )
5193- class TestSharedMemoryManagerTypes (_MixinTestCommonManagerTypes ,
5194- unittest .TestCase ):
5195- pass
5196- else :
5197- class TestSharedMemoryManagerTypes (_MixinTestCommonManagerTypes ,
5198- unittest .TestCase ):
5199- """Same as above but by using SharedMemoryManager."""
5200- manager_class = multiprocessing .shared_memory .SharedMemoryManager
5201-
5202-
52035182class MiscTestCase (unittest .TestCase ):
52045183 def test__all__ (self ):
52055184 # Just make sure names in blacklist are excluded
0 commit comments