New issue 637: Assertion reverse engineering often fails
https://bitbucket.org/hpk42/pytest/issue/637/assertion-reverse-engineering-often-fails

gcc111:

Consider the following simple program:

```
#!python
var = None
def test_foo():
    assert 'Hello' == var, "whee"
```

I get the following output from py.test:

        ======================================================= test session 
starts ========================================================
        platform linux2 -- Python 2.7.3 -- py-1.4.22 -- pytest-2.6.0
        plugins: django-assets, django
        collected 0 items / 1 errors 

        ============================================================== ERRORS 
==============================================================
        ________________________________________ ERROR collecting 
../../../../../../../tmp/test.py _________________________________________
        /tmp/test.py:3: in <module>
            assert 'Hello' == var, "whee"
        E   AssertionError: whee
        ===================================================== 1 error in 0.06 
seconds ======================================================

Which is very pretty, but didn't actually tell me what went wrong, by giving me 
the values of the left and right hand sides of the assertion.

I have to switch back to UnitTest.assertEqual, which does tell me (when I set 
longMessage = True):

        Traceback (most recent call last):
          File "test.py", line 9, in test_foo
            self.assertEqual('Hello', var, "whee")
        AssertionError: 'Hello' != None : whee



_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to