@@ -617,53 +617,6 @@ def test_unix_socket(self):
617617 connected , MongoClient ("mongodb://%2Ftmp%2Fnon-existent.sock" ,
618618 serverSelectionTimeoutMS = 100 ))
619619
620- def test_fork (self ):
621- # Test using a client before and after a fork.
622- if sys .platform == "win32" :
623- raise SkipTest ("Can't fork on windows" )
624- try :
625- import multiprocessing
626- except ImportError :
627- raise SkipTest ("No multiprocessing module" )
628-
629- db = self .client .pymongo_test
630-
631- # Ensure a socket is opened before the fork.
632- db .test .find_one ()
633-
634- def f (pipe ):
635- try :
636- kill_cursors_executor = self .client ._kill_cursors_executor
637- servers = self .client ._topology .select_servers (
638- any_server_selector )
639-
640- # In child, only the thread that called fork() is alive.
641- # The first operation should revive the rest.
642- db .test .find_one ()
643- wait_until (
644- lambda : all (s ._monitor ._executor ._thread .is_alive ()
645- for s in servers ),
646- "restart monitor threads" )
647-
648- wait_until (lambda : kill_cursors_executor ._thread .is_alive (),
649- "restart kill-cursors executor" )
650- except :
651- traceback .print_exc () # Aid debugging.
652- pipe .send (True )
653-
654- parent_pipe , child_pipe = multiprocessing .Pipe ()
655- p = multiprocessing .Process (target = f , args = (child_pipe ,))
656- p .start ()
657- p .join (10 )
658- child_pipe .close ()
659-
660- # Pipe will only have data if the child process failed.
661- try :
662- parent_pipe .recv ()
663- self .fail ()
664- except EOFError :
665- pass
666-
667620 def test_document_class (self ):
668621 c = self .client
669622 db = c .pymongo_test
0 commit comments