@@ -119,6 +119,9 @@ def _resource_unlink(name, rtype):
119
119
else :
120
120
TIMEOUT1 , TIMEOUT2 , TIMEOUT3 = 0.1 , 0.1 , 0.1
121
121
122
+ # BaseManager.shutdown_timeout
123
+ SHUTDOWN_TIMEOUT = support .SHORT_TIMEOUT
124
+
122
125
HAVE_GETVALUE = not getattr (_multiprocessing ,
123
126
'HAVE_BROKEN_SEM_GETVALUE' , False )
124
127
@@ -2897,7 +2900,7 @@ class _TestMyManager(BaseTestCase):
2897
2900
ALLOWED_TYPES = ('manager' ,)
2898
2901
2899
2902
def test_mymanager (self ):
2900
- manager = MyManager ()
2903
+ manager = MyManager (shutdown_timeout = SHUTDOWN_TIMEOUT )
2901
2904
manager .start ()
2902
2905
self .common (manager )
2903
2906
manager .shutdown ()
@@ -2908,15 +2911,16 @@ def test_mymanager(self):
2908
2911
self .assertIn (manager ._process .exitcode , (0 , - signal .SIGTERM ))
2909
2912
2910
2913
def test_mymanager_context (self ):
2911
- with MyManager () as manager :
2914
+ manager = MyManager (shutdown_timeout = SHUTDOWN_TIMEOUT )
F438
2915
+ with manager :
2912
2916
self .common (manager )
2913
2917
# bpo-30356: BaseManager._finalize_manager() sends SIGTERM
2914
2918
# to the manager process if it takes longer than 1 second to stop,
2915
2919
# which happens on slow buildbots.
2916
2920
self .assertIn (manager ._process .exitcode , (0 , - signal .SIGTERM ))
2917
2921
2918
2922
def test_mymanager_context_prestarted (self ):
2919
- manager = MyManager ()
2923
+ manager = MyManager (shutdown_timeout = SHUTDOWN_TIMEOUT )
2920
2924
manager .start ()
2921
2925
with manager :
2922
2926
self .common (manager )
@@ -2978,8 +2982,8 @@ class _TestRemoteManager(BaseTestCase):
2978
2982
@classmethod
2979
2983
def _putter (cls , address , authkey ):
2980
2984
manager = QueueManager2 (
2981
- address = address , authkey = authkey , serializer = SERIALIZER
2982
- )
2985
+ address = address , authkey = authkey , serializer = SERIALIZER ,
2986
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
2983
2987
manager .connect ()
2984
2988
queue = manager .get_queue ()
2985
2989
# Note that xmlrpclib will deserialize object as a list not a tuple
@@ -2989,8 +2993,8 @@ def test_remote(self):
2989
2993
authkey = os .urandom (32 )
2990
2994
2991
2995
manager = QueueManager (
2992
- address = (socket_helper .HOST , 0 ), authkey = authkey , serializer = SERIALIZER
2993
- )
2996
+ address = (socket_helper .HOST , 0 ), authkey = authkey , serializer = SERIALIZER ,
2997
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
2994
2998
manager .start ()
2995
2999
self .addCleanup (manager .shutdown )
2996
3000
@@ -2999,8 +3003,8 @@ def test_remote(self):
2999
3003
p .start ()
3000
3004
3001
3005
manager2 = QueueManager2 (
3002
- address = manager .address , authkey = authkey , serializer = SERIALIZER
3003
- )
3006
+ address = manager .address , authkey = authkey , serializer = SERIALIZER ,
3007
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
3004
3008
manager2 .connect ()
3005
3009
queue = manager2 .get_queue ()
3006
3010
@@ -3020,15 +3024,17 @@ class _TestManagerRestart(BaseTestCase):
3020
3024
@classmethod
3021
3025
def _putter (cls , address , authkey ):
3022
3026
manager = QueueManager (
3023
- address = address , authkey = authkey , serializer = SERIALIZER )
3027
+ address = address , authkey = authkey , serializer = SERIALIZER ,
3028
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
3024
3029
manager .connect ()
3025
3030
queue = manager .get_queue ()
3026
3031
queue .put ('hello world' )
3027
3032
3028
3033
def test_rapid_restart (self ):
3029
3034
authkey = os .urandom (32 )
3030
3035
manager = QueueManager (
3031
- address = (socket_helper .HOST , 0 ), authkey = authkey , serializer = SERIALIZER )
3036
+ address = (socket_helper .HOST , 0 ), authkey = authkey ,
3037
+ serializer = SERIALIZER , shutdown_timeout = SHUTDOWN_TIMEOUT )
3032
3038
try :
3033
3039
srvr = manager .get_server ()
3034
3040
addr = srvr .address
@@ -3048,7 +3054,8 @@ def test_rapid_restart(self):
3048
3054
manager .shutdown ()
3049
3055
3050
3056
manager = QueueManager (
3051
- address = addr , authkey = authkey , serializer = SERIALIZER )
3057
+ address = addr , authkey = authkey , serializer = SERIALIZER ,
3058
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
3052
3059
try :
3053
3060
manager .start ()
3054
3061
self .addCleanup (manager .shutdown )
@@ -3059,7 +3066,8 @@ def test_rapid_restart(self):
3059
3066
# (sporadic failure on buildbots)
3060
3067
time .sleep (1.0 )
3061
3068
manager = QueueManager (
3062
- address = addr , authkey = authkey , serializer = SERIALIZER )
3069
+ address = addr , authkey = authkey , serializer = SERIALIZER ,
3070
+ shutdown_timeout = SHUTDOWN_TIMEOUT )
3063
3071
if hasattr (manager , "shutdown" ):
3064
3072
self .addCleanup (manager .shutdown )
3065
3073
0 commit comments