Skip to content

Commit 0d308de

Browse files
author
Matias Melograno
committed
removed global in test
1 parent 4ba2fb2 commit 0d308de

File tree

3 files changed

+13
-26
lines changed

3 files changed

+13
-26
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
8.3.2 (Dec XX, 2020)
22
- Added RecordStats for supporting pipelined recording in redis when treatment call is made.
3+
- Added hooks support for UWSGI.
34

45
8.3.1 (Nov 20, 2020)
56
- Fixed error handling when split server fails, so that it doesn't bring streaming down.

splitio/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '8.3.2-rc2'
1+
__version__ = '8.3.2-rc3'

tests/client/test_factory.py

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)