-
Notifications
You must be signed in to change notification settings - Fork 917
Update built-in partitioner options to include murmur2 #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,3 +168,26 @@ def handle_dr(err, msg): | |
p.produce('mytopic', "\xc2\xc2", on_delivery=handle_dr) | ||
|
||
p.flush() | ||
|
||
|
||
def test_set_partioner_murmur2(): | ||
""" | ||
Test ability to set built-in partitioner type murmur | ||
""" | ||
Producer({'partitioner': 'murmur2'}) | ||
|
||
|
||
def test_set_partioner_murmur2_random(): | ||
""" | ||
Test ability to set built-in partitioner type murmur2_random | ||
""" | ||
Producer({'partitioner': 'murmur2_random'}) | ||
|
||
|
||
def test_set_invalid_partioner_murmur(): | ||
""" | ||
Assert invalid partitioner raises KafkaException | ||
""" | ||
with pytest.raises(KafkaException) as e: | ||
Producer({'partitioner': 'murmur'}) | ||
assert e == 'unknown builtin partitioner: murmur' in e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are you certain this works, referencing the exception from with the block? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would fail otherwise no? I have tested it without checking for the raised exception at all and it raised the appropriate exception There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the assert is never reached since Producer() raises an exception There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep you are correct. https://github.com/pytest-dev/pytest/blob/master/src/_pytest/python_api.py#L528-L547 fixing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
partitioner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still partioner