Skip to content
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

Add an example consumer callback #40

Merged
merged 4 commits into from Aug 23, 2018
Merged

Conversation

jeremycline
Copy link
Member

I found myself regularly wanting a callback available to test with, so this just adds a simple printer callback. This also led to the discovery of a few small issues when I wrote a test, so those have been fixed as well.

According the documentation, to use the @<property>.setter notation, the
decorated functions all need the same name[0]. Without this, trying to
set the property fails with an AttributeError.

[0] https://docs.python.org/3/library/functions.html#property

Signed-off-by: Jeremy Cline <jcline@redhat.com>
There's a slight difference in the JSON dumping format between Python 2
and 3.4+[0]. The default separators change if indent is not None. This
sets the separators explicitly to the Python 3 default so Python 2 looks
the same. This is mostly so writing tests for expected output isn't so
annoying.

[0] https://docs.python.org/3/library/json.html#json.dump

Signed-off-by: Jeremy Cline <jcline@redhat.com>
This is useful just as an example, and also because it's nice to have an
importable callback that conforms to the API handy for testing purposes.

Signed-off-by: Jeremy Cline <jcline@redhat.com>
@jeremycline jeremycline requested a review from a team as a code owner August 22, 2018 17:43
@codecov-io
Copy link

codecov-io commented Aug 22, 2018

Codecov Report

Merging #40 into master will increase coverage by 0.33%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #40      +/-   ##
==========================================
+ Coverage   88.59%   88.93%   +0.33%     
==========================================
  Files          10       11       +1     
  Lines         763      768       +5     
  Branches      105      105              
==========================================
+ Hits          676      683       +7     
+ Misses         60       58       -2     
  Partials       27       27
Impacted Files Coverage Δ
fedora_messaging/message.py 97.24% <ø> (+1.83%) ⬆️
fedora_messaging/example.py 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b5c8a4...50d11ac. Read the comment docs.

Copy link

@puiterwijk puiterwijk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow. Nice and simple! 👍

@mergify mergify bot merged commit e8f611f into fedora-infra:master Aug 23, 2018
@jeremycline jeremycline deleted the examples branch August 23, 2018 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants