@@ -521,41 +521,27 @@ def _get_storage_mock(self, name):
521521
522522 mocker .patch ('splitio.client.factory.SplitFactory._get_storage' , new = _get_storage_mock )
523523
524- global called_sync_all
525- called_sync_all = 0
526- global called_start
527- called_start = 0
528- global called_recreate
529- called_recreate = 0
530-
531- # Mocking
532- def _sync_all (self ):
533- global called_sync_all
534- called_sync_all += 1
535- mocker .patch ('splitio.sync.synchronizer.Synchronizer.sync_all' , new = _sync_all )
536-
537- def _start (self ):
538- global called_start
539- called_start += 1
540- mocker .patch ('splitio.sync.manager.Manager.start' , new = _start )
524+ sync_all_mock = mocker .Mock ()
525+ mocker .patch ('splitio.sync.synchronizer.Synchronizer.sync_all' , new = sync_all_mock )
526+
527+ start_mock = mocker .Mock ()
528+ mocker .patch ('splitio.sync.manager.Manager.start' , new = start_mock )
541529
542- def _recreate (self ):
543- global called_recreate
544- called_recreate += 1
545- mocker .patch ('splitio.sync.manager.Manager.recreate' , new = _recreate )
530+ recreate_mock = mocker .Mock ()
531+ mocker .patch ('splitio.sync.manager.Manager.recreate' , new = recreate_mock )
546532
547533 config = {
548534 'preforkedInitialization' : True ,
549535 }
550536 factory = get_factory ("none" , config = config )
551537 factory .block_until_ready (10 )
552538 assert factory ._status == Status .WAITING_FORK
553- assert called_sync_all == 1
554- assert called_start == 0
539+ assert len ( sync_all_mock . mock_calls ) == 1
540+ assert len ( start_mock . mock_calls ) == 0
555541
556542 factory .handle_post_fork ()
557- assert called_recreate == 1
558- assert called_start == 1
543+ assert len ( recreate_mock . mock_calls ) == 1
544+ assert len ( start_mock . mock_calls ) == 1
559545
560546 assert clear_impressions ._called == 1
561547 assert clear_events ._called == 1
0 commit comments