nestorsalceda/mamba — pull request #16 by jvrsantacruz (2013-09-16 19:52:27+00:00)
Title: Adds example group failure reporting  fixes #15

When an exception happens to be raised within a `(before|after).all` function, forcing an entire example group to fail, all failed/not-run examples within the group are ignored by the reporter.
Yet the process stills returns 1, and therefore marks the build as a failure.

Adds `Reporter.example_group_failed` and `Formatter.example_group_failed` which handle this situation, by reporting examples within the failed group as failed, bloody red allover.

This ensures that the run won't cheerfuly fail all in green, while displaying "0 specs ran".
It should fix https://github.com/nestorsalceda/mamba/issues/15

```python
from mamba import describe, before

with describe('weird mamba behaviour'):
@before.all
def setup():
raise Exception()

def should_not_pass():
pass
```

now outputs

```
$ mamba test_spec.py
weird mamba behaviour
✗ should not pass

1 examples failed of 1 ran in 0.0187 seconds

Failures:

1) weird mamba behaviour should not pass
Failure/Error:

Traceback:
File "/home/user/mamba/mamba/example_group.py", line 61, in _run_inner_examples
self.run_hook('before_all')
File "/home/user/mamba/mamba/example_group.py", line 69, in run_hook
registered()
File "test_spec.py", line 7, in setup
raise Exception()
$ echo $?
1
```

instead of

```
$mamba test_spec.py
weird mamba behaviour

0 examples ran in 0.0180 seconds
$ echo $?
1
```