Skip to content

Commit 5d0f132

Browse files
authored
Merge pull request #97 from launchdarkly/6.4.1
prepare 6.4.1 release
2 parents fc80a43 + 55dfffc commit 5d0f132

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

scripts/release.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ SETUP_PY_TEMP=./setup.py.tmp
2121
sed "s/ldclient_version=.*/ldclient_version='${VERSION}'/g" setup.py > ${SETUP_PY_TEMP}
2222
mv ${SETUP_PY_TEMP} setup.py
2323

24-
python setup.py sdist upload
24+
# Prepare distribution
25+
python setup.py sdist
26+
27+
# Upload with Twine
28+
pip install twine
29+
twine upload dist/*
2530

2631
echo "Done with python-client release"

test-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
mock>=2.0.0
22
pytest>=2.8
33
redis>=2.10.5
4-
coverage>=4.3.4,<4.4
4+
coverage>=4.4
5+
pytest-capturelog>=0.7
56
pytest-cov>=2.4.0
67
codeclimate-test-reporter>=0.2.1

testing/test_feature_store.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88
from ldclient.versioned_data_kind import FEATURES
99

1010

11+
def get_log_lines(caplog):
12+
loglines = caplog.records
13+
if callable(loglines):
14+
# records() is a function in older versions of the caplog plugin
15+
loglines = loglines()
16+
return loglines
17+
18+
1119
class TestFeatureStore:
1220
redis_host = 'localhost'
1321
redis_port = 6379
@@ -162,3 +170,25 @@ def hook(base_key, key):
162170
store.upsert(FEATURES, feature)
163171
result = store.get(FEATURES, 'flagkey', lambda x: x)
164172
assert result['version'] == 5
173+
174+
def test_exception_is_handled_in_get(self, caplog):
175+
# This just verifies the fix for a bug that caused an error during exception handling in Python 3
176+
store = RedisFeatureStore(url='redis://bad')
177+
feature = store.get(FEATURES, 'flagkey')
178+
assert feature is None
179+
loglines = get_log_lines(caplog)
180+
assert len(loglines) == 2
181+
message = loglines[1].message
182+
assert message.startswith("RedisFeatureStore: Could not retrieve key flagkey from 'features' with error:")
183+
assert "connecting to bad:6379" in message
184+
185+
def test_exception_is_handled_in_all(self, caplog):
186+
# This just verifies the fix for a bug that caused an error during exception handling in Python 3
187+
store = RedisFeatureStore(url='redis://bad')
188+
all = store.all(FEATURES, lambda x: x)
189+
assert all is None
190+
loglines = get_log_lines(caplog)
191+
assert len(loglines) == 2
192+
message = loglines[1].message
193+
assert message.startswith("RedisFeatureStore: Could not retrieve 'features' from Redis")
194+
assert "connecting to bad:6379" in message

0 commit comments

Comments
 (0)