Skip to content

Commit

Permalink
Merge pull request #9 from DrBenton/add-coveralls
Browse files Browse the repository at this point in the history
Add code coverage, via Coveralls
  • Loading branch information
olivierphi committed Sep 27, 2018
2 parents f8eb53a + 7243aba commit 5316031
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
9 changes: 7 additions & 2 deletions .travis.yml
Expand Up @@ -3,6 +3,11 @@ python:
- "3.6"
- "3.7-dev"
install:
- pip install -U pytest pylint mypy "black==18.6b4" pytest-pylint pytest-mypy pytest-black
- pip install -U pytest pylint mypy "black==18.6b4"
- pip install -U pytest-pylint pytest-mypy pytest-black
# Code coverage:
- pip install -U coverage python-coveralls pytest-cov
script:
- make test
- pytest --pylint --black --mypy --cov pymessagebus --cov-report term-missing pymessagebus
after_success:
- coveralls
16 changes: 12 additions & 4 deletions README.md
@@ -1,8 +1,14 @@
# pymessagebus

<!-- [![Build Status](https://travis-ci.org/DrBenton/pymessagebus.svg?branch=master)](https://travis-ci.org/DrBenton/pymessagebus) -->
<h2 align="center">a Message/Command Bus for Python</h2>

Pymessagebus is a message bus library. It comes with a generic MessageBus class and a more specialised CommandBus one.
<p align="center">
<a href="https://travis-ci.org/DrBenton/pymessagebus"><img alt="Build Status" src="https://travis-ci.org/DrBenton/pymessagebus.svg?branch=master"></a>
<a href='https://coveralls.io/github/DrBenton/pymessagebus?branch=master'><img src="https://coveralls.io/repos/github/DrBenton/pymessagebus/badge.svg?branch=master" alt="Coverage Status" /></a>
<a href="https://github.com/ambv/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
</p>

Pymessagebus is a message bus library. It comes with a generic MessageBus class, as well as a more specialised CommandBus one.

_N.B.: here the "Message Bus" / "Command Bus" terms refer to a design patterns, and have nothing to do with messaging systems like RabbitMQ. (even though they can be used together)_

Expand Down Expand Up @@ -112,8 +118,10 @@ The API is thus exactly the same than the MessageBus, with the following technic

The CommandBus constructor have additional options that you can use to customise its behaviour:

- `allow_result`: it's possible to be stricter about the implementation of the CommandBus pattern, by using the `allow_result=True` named parameter when the clas is instaciated (the default value being `False`). In that case the result of the `handle(message)` will always be `None`. That way one can follow a more pure version of the design pattern. (and access the result of the COmmand handling via the application repositories)
- `locking`: by default the CommandBus will raise a `api.CommandBusAlreadyRunningAMessageError` exception if a message is sent to it while another message is still processed (which can happen if one of the Command Handlers sends a message to the bus). You can disable this behaviour by setting the named argument `locking=False` (the default value being `True`).
- `allow_result`: it's possible to be stricter about the implementation of the CommandBus pattern, by using the `allow_result=True` named parameter when the class is instanciated (the default value being `False`).
In that case the result of the `handle(message)` will always be `None`. By doing this one can follow a more pure version of the design pattern. (and access the result of the Command handling via the application repositories, though a pre-generated id attached to the message for example)
- `locking`: by default the CommandBus will raise a `api.CommandBusAlreadyRunningAMessageError` exception if a message is sent to it while another message is still processed (which can happen if one of the Command Handlers sends a message to the bus).
You can disable this behaviour by setting the named argument `locking=False` (the default value being `True`).

#### Middlewares

Expand Down

0 comments on commit 5316031

Please sign in to comment.