Skip to content

Commit 845fb1c

Browse files
committed
Fixed tests
1 parent d5baa79 commit 845fb1c

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

splitio/engine/impressions/strategies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ def process_impressions(self, impressions):
100100
"""
101101
imps = [(self._observer.test_and_set(imp), attrs) for imp, attrs in impressions]
102102
self._counter.track([imp for imp, _ in imps if imp.previous_time != None])
103-
this_hour = truncate_time(util.utctime_ms())
103+
this_hour = truncate_time(utctime_ms())
104104
return [i for i, _ in imps if i.previous_time is None or i.previous_time < this_hour], imps

tests/client/test_input_validator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,8 @@ def test_input_validation_factory(self, mocker):
11791179

11801180
logger.reset_mock()
11811181
try:
1182-
f = get_factory(True, config={'redisHost': 'some-host'})
1182+
f = get_factory(True, config={'redisHost': 'localhost'})
11831183
except:
11841184
pass
11851185
assert logger.error.mock_calls == []
1186+
f.destroy()

tests/integration/test_client_e2e.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def _validate_last_impressions(self, client, *to_validate):
9292

9393
def test_get_treatment(self):
9494
"""Test client.get_treatment()."""
95-
client = self.factory.client()
95+
try:
96+
client = self.factory.client()
97+
except:
98+
pass
9699

97100
assert client.get_treatment('user1', 'sample_feature') == 'on'
98101
self._validate_last_impressions(client, ('sample_feature', 'user1', 'on'))
@@ -135,8 +138,10 @@ def test_get_treatment(self):
135138

136139
def test_get_treatment_with_config(self):
137140
"""Test client.get_treatment_with_config()."""
138-
client = self.factory.client()
139-
141+
try:
142+
client = self.factory.client()
143+
except:
144+
pass
140145
result = client.get_treatment_with_config('user1', 'sample_feature')
141146
assert result == ('on', '{"size":15,"test":20}')
142147
self._validate_last_impressions(client, ('sample_feature', 'user1', 'on'))
@@ -161,8 +166,10 @@ def test_get_treatment_with_config(self):
161166

162167
def test_get_treatments(self):
163168
"""Test client.get_treatments()."""
164-
client = self.factory.client()
165-
169+
try:
170+
client = self.factory.client()
171+
except:
172+
pass
166173
result = client.get_treatments('user1', ['sample_feature'])
167174
assert len(result) == 1
168175
assert result['sample_feature'] == 'on'
@@ -211,7 +218,10 @@ def test_get_treatments(self):
211218

212219
def test_get_treatments_with_config(self):
213220
"""Test client.get_treatments_with_config()."""
214-
client = self.factory.client()
221+
try:
222+
client = self.factory.client()
223+
except:
224+
pass
215225

216226
result = client.get_treatments_with_config('user1', ['sample_feature'])
217227
assert len(result) == 1
@@ -757,7 +767,10 @@ def test_get_treatments_with_config(self):
757767

758768
def test_manager_methods(self):
759769
"""Test manager.split/splits."""
760-
manager = self.factory.manager()
770+
try:
771+
manager = self.factory.manager()
772+
except:
773+
pass
761774
result = manager.split('all_feature')
762775
assert result.name == 'all_feature'
763776
assert result.traffic_type is None

0 commit comments

Comments
 (0)