[Pytest-commit] Issue #549: Provide option for message & diff. (hpk42/pytest)

Sarah Bird issues-reply at bitbucket.org
Tue Jul 29 13:18:49 CEST 2014


New issue 549: Provide option for message & diff.
https://bitbucket.org/hpk42/pytest/issue/549/provide-option-for-message-diff

Sarah Bird:

Currently, if I have a test:

```
#!python

def test_string():
    assert 'my silly string' == 'my not so silly string'
```

Then I get the fail message:

```
#!shell

E       assert 'my silly string' == 'my not so silly string'
E         - my silly string
E         + my not so silly string
E         ?   +++++++

```
With all its pytest helpful diff glory.

If I have the test:
```
#!python

def test_string():
    assert 'my silly string' == 'my not so silly string', 'Silly strings should always match.'
```

I get the fail message:


```
#!shell

E       AssertionError: Silly strings should always match.
```

I discussed this a little with the pytest team sprinting at EuroPython and this is correct in the sense that a message is meant to be the defining output. But at the same time, as soon as I use a message I have no way to access all of pytest's helpful diffing and I'd like a way.  It may be a tag like --message-full, but I'd love to get the error message:
```
#!shell

E       AssertionError: Silly strings should always match.
E 
E       assert 'my silly string' == 'my not so silly string'
E         - my silly string
E         + my not so silly string
E         ?   +++++++

```




More information about the pytest-commit mailing list