Skip to content

Commit

Permalink
prepare 5.0.3 release (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Apr 11, 2018
1 parent a64e208 commit 5cfa151
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 40 deletions.
61 changes: 61 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: 2
workflows:
version: 2
test:
jobs:
- test-2.7
- test-3.3
- test-3.4
- test-3.5
- test-3.6
test-template: &test-template
steps:
- checkout
- run:
name: install requirements
command: |
sudo pip install --upgrade pip setuptools;
sudo pip install -r test-requirements.txt;
sudo python setup.py install;
pip freeze
- run:
name: run tests
command: |
mkdir test-reports;
if [[ $CIRCLE_JOB == test-2.7 ]]; then
pytest -s --cov=ldclient --junitxml=test-reports/junit.xml testing;
sh -c '[ -n "${CODECLIMATE_REPO_TOKEN+1}" ] && codeclimate-test-reporter || echo "No CODECLIMATE_REPO_TOKEN value is set; not publishing coverage report"';
else
pytest -s --junitxml=test-reports/junit.xml testing;
fi
- store_test_results:
path: test-reports
- store_artifacts:
path: test-reports

jobs:
test-2.7:
<<: *test-template
docker:
- image: circleci/python:2.7-jessie
- image: redis
test-3.3:
<<: *test-template
docker:
- image: circleci/python:3.3-jessie
- image: redis
test-3.4:
<<: *test-template
docker:
- image: circleci/python:3.4-jessie
- image: redis
test-3.5:
<<: *test-template
docker:
- image: circleci/python:3.5-jessie
- image: redis
test-3.6:
<<: *test-template
docker:
- image: circleci/python:3.6-jessie
- image: redis
36 changes: 0 additions & 36 deletions circle.yml

This file was deleted.

2 changes: 1 addition & 1 deletion ldclient/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _bucket_user(user, key, salt, bucket_by):
def _bucketable_string_value(u_value):
if isinstance(u_value, six.string_types):
return u_value
if isinstance(u_value, (int, long)):
if isinstance(u_value, six.integer_types):
return str(u_value)
return None

Expand Down
1 change: 1 addition & 0 deletions ldclient/redis_feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def all(self, kind, callback):

results = {}
for key, item_json in all_items.items():
key = key.decode('utf-8') # necessary in Python 3
item = json.loads(item_json.decode('utf-8'))
if item.get('deleted', False) is False:
results[key] = item
Expand Down
24 changes: 21 additions & 3 deletions testing/test_ldclient.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from builtins import object
from ldclient.client import LDClient, Config
from ldclient.feature_store import InMemoryFeatureStore
from ldclient.interfaces import FeatureRequester, FeatureStore
from ldclient.interfaces import FeatureRequester, FeatureStore, UpdateProcessor
import pytest
from testing.sync_util import wait_until

Expand All @@ -11,6 +11,20 @@
import Queue as queue


class MockUpdateProcessor(UpdateProcessor):
def __init__(self, config, requestor, store, ready):
ready.set()

def start(self):
pass

def stop(self):
pass

def is_alive(self):
return True


class MockFeatureStore(FeatureStore):
def delete(self, key, version):
pass
Expand Down Expand Up @@ -54,13 +68,14 @@ def get(self, key):
return None


client = LDClient(config=Config(base_uri="http://localhost:3000", feature_store=MockFeatureStore()))
client = LDClient(config=Config(base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
update_processor_class=MockUpdateProcessor))
offline_client = LDClient(config=
Config(sdk_key="secret", base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
offline=True))
no_send_events_client = LDClient(config=
Config(sdk_key="secret", base_uri="http://localhost:3000", feature_store=MockFeatureStore(),
send_events=False))
send_events=False, update_processor_class=MockUpdateProcessor))

user = {
u'key': u'xyz',
Expand Down Expand Up @@ -224,6 +239,7 @@ def test_defaults_and_online():
defaults={"foo": expected},
event_consumer_class=MockConsumer,
feature_requester_class=MockFeatureRequester,
update_processor_class=MockUpdateProcessor,
feature_store=InMemoryFeatureStore()))
actual = my_client.variation('foo', user, default="originalDefault")
assert actual == expected
Expand All @@ -234,6 +250,7 @@ def test_defaults_and_online_no_default():
client = LDClient(config=Config(base_uri="http://localhost:3000",
defaults={"foo": "bar"},
event_consumer_class=MockConsumer,
update_processor_class=MockUpdateProcessor,
feature_requester_class=MockFeatureRequester))
assert "jim" == client.variation('baz', user, default="jim")
assert wait_for_event(client, lambda e: e['kind'] == 'feature' and e['key'] == u'baz' and e['user'] == user)
Expand All @@ -251,6 +268,7 @@ def get_all(self):
defaults={"foo": "bar"},
feature_store=InMemoryFeatureStore(),
feature_requester_class=ExceptionFeatureRequester,
update_processor_class=MockUpdateProcessor,
event_consumer_class=MockConsumer))
assert "bar" == client.variation('foo', user, default="jim")
assert wait_for_event(client, lambda e: e['kind'] == 'feature' and e['key'] == u'foo' and e['user'] == user)
Expand Down

0 comments on commit 5cfa151

Please sign in to comment.