Skip to content

Commit 5cfa151

Browse files
authored
prepare 5.0.3 release (#79)
1 parent a64e208 commit 5cfa151

File tree

5 files changed

+84
-40
lines changed

5 files changed

+84
-40
lines changed

.circleci/config.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
version: 2
2+
workflows:
3+
version: 2
4+
test:
5+
jobs:
6+
- test-2.7
7+
- test-3.3
8+
- test-3.4
9+
- test-3.5
10+
- test-3.6
11+
test-template: &test-template
12+
steps:
13+
- checkout
14+
- run:
15+
name: install requirements
16+
command: |
17+
sudo pip install --upgrade pip setuptools;
18+
sudo pip install -r test-requirements.txt;
19+
sudo python setup.py install;
20+
pip freeze
21+
- run:
22+
name: run tests
23+
command: |
24+
mkdir test-reports;
25+
if [[ $CIRCLE_JOB == test-2.7 ]]; then
26+
pytest -s --cov=ldclient --junitxml=test-reports/junit.xml testing;
27+
sh -c '[ -n "${CODECLIMATE_REPO_TOKEN+1}" ] && codeclimate-test-reporter || echo "No CODECLIMATE_REPO_TOKEN value is set; not publishing coverage report"';
28+
else
29+
pytest -s --junitxml=test-reports/junit.xml testing;
30+
fi
31+
- store_test_results:
32+
path: test-reports
33+
- store_artifacts:
34+
path: test-reports
35+
36+
jobs:
37+
test-2.7:
38+
<<: *test-template
39+
docker:
40+
- image: circleci/python:2.7-jessie
41+
- image: redis
42+
test-3.3:
43+
<<: *test-template
44+
docker:
45+
- image: circleci/python:3.3-jessie
46+
- image: redis
47+
test-3.4:
48+
<<: *test-template
49+
docker:
50+
- image: circleci/python:3.4-jessie
51+
- image: redis
52+
test-3.5:
53+
<<: *test-template
54+
docker:
55+
- image: circleci/python:3.5-jessie
56+
- image: redis
57+
test-3.6:
58+
<<: *test-template
59+
docker:
60+
- image: circleci/python:3.6-jessie
61+
- image: redis

circle.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

ldclient/flag.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _bucket_user(user, key, salt, bucket_by):
133133
def _bucketable_string_value(u_value):
134134
if isinstance(u_value, six.string_types):
135135
return u_value
136-
if isinstance(u_value, (int, long)):
136+
if isinstance(u_value, six.integer_types):
137137
return str(u_value)
138138
return None
139139

ldclient/redis_feature_store.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def all(self, kind, callback):
7373

7474
results = {}
7575
for key, item_json in all_items.items():
76+
key = key.decode('utf-8') # necessary in Python 3
7677
item = json.loads(item_json.decode('utf-8'))
7778
if item.get('deleted', False) is False:
7879
results[key] = item

testing/test_ldclient.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from builtins import object
22
from ldclient.client import LDClient, Config
33
from ldclient.feature_store import InMemoryFeatureStore
4-
from ldclient.interfaces import FeatureRequester, FeatureStore
4+
from ldclient.interfaces import FeatureRequester, FeatureStore, UpdateProcessor
55
import pytest
66
from testing.sync_util import wait_until
77

@@ -11,6 +11,20 @@
1111
import Queue as queue
1212

1313

14+
class MockUpdateProcessor(UpdateProcessor):
15+
def __init__(self, config, requestor, store, ready):
16+
ready.set()
17+
18+
def start(self):
19+
pass
20+
21+
def stop(self):
22+
pass
23+
24+
def is_alive(self):
25+
return True
26+
27+
1428
class MockFeatureStore(FeatureStore):
1529
def delete(self, key, version):
1630
pass
@@ -54,13 +68,14 @@ def get(self, key):
5468
return None
5569

5670

57-
client = LDClient(config=Config(base_uri="http://localhost:3000", feature_store=MockFeatureStore()))
71+
client = LDClient(config=Config(base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
72+
update_processor_class=MockUpdateProcessor))
5873
offline_client = LDClient(config=
5974
Config(sdk_key="secret", base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
6075
offline=True))
6176
no_send_events_client = LDClient(config=
6277
Config(sdk_key="secret", base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
63-
send_events=False))
78+
send_events=False, update_processor_class=MockUpdateProcessor))
6479

6580
user = {
6681
u'key': u'xyz',
@@ -224,6 +239,7 @@ def test_defaults_and_online():
224239
defaults={"foo": expected},
225240
event_consumer_class=MockConsumer,
226241
feature_requester_class=MockFeatureRequester,
242+
update_processor_class=MockUpdateProcessor,
227243
feature_store=InMemoryFeatureStore()))
228244
actual = my_client.variation('foo', user, default="originalDefault")
229245
assert actual == expected
@@ -234,6 +250,7 @@ def test_defaults_and_online_no_default():
234250
client = LDClient(config=Config(base_uri="http://localhost:3000",
235251
defaults={"foo": "bar"},
236252
event_consumer_class=MockConsumer,
253+
update_processor_class=MockUpdateProcessor,
237254
feature_requester_class=MockFeatureRequester))
238255
assert "jim" == client.variation('baz', user, default="jim")
239256
assert wait_for_event(client, lambda e: e['kind'] == 'feature' and e['key'] == u'baz' and e['user'] == user)
@@ -251,6 +268,7 @@ def get_all(self):
251268
defaults={"foo": "bar"},
252269
feature_store=InMemoryFeatureStore(),
253270
feature_requester_class=ExceptionFeatureRequester,
271+
update_processor_class=MockUpdateProcessor,
254272
event_consumer_class=MockConsumer))
255273
assert "bar" == client.variation('foo', user, default="jim")
256274
assert wait_for_event(client, lambda e: e['kind'] == 'feature' and e['key'] == u'foo' and e['user'] == user)

0 commit comments

Comments
 (0)