If raises() in that test is py.test's raises() when the tests are run with py.test, then there's really no need to test it at all. We only need to test our own raises().
Aaron Meurer On Sat, Sep 27, 2014 at 5:19 PM, Peter Brady <[email protected]> wrote: > The failures in sympy/utilities/tests/test_pytest.py are due to a > fundamental difference between bin/test and py.test (perhaps this was not a > difference when the tests were written) > > The failing tests: > > =================================== FAILURES > =================================== > ___________ test_lack_of_exception_triggers_AssertionError_callable > ____________ > > def test_lack_of_exception_triggers_AssertionError_callable(): > try: >> raises(Exception, lambda: 1 + 1) > E Failed: DID NOT RAISE > > sympy/utilities/tests/test_pytest.py:14: Failed > _____________ test_lack_of_exception_triggers_AssertionError_with > ______________ > > def test_lack_of_exception_triggers_AssertionError_with(): > try: > with raises(Exception): >> 1 + 1 > E Failed: DID NOT RAISE > > sympy/utilities/tests/test_pytest.py:39: Failed > > The cause of these is that the tests are written with the assumption > that when raises fails, it raises and AssertionError. However py.test > raises and actual Failed exception. Here's an example > > In [4]: from py.test import fail > > In [5]: raise fail() > --------------------------------------------------------------------------- > Failed Traceback (most recent call last) > <ipython-input-5-64d514b43c4e> in <module>() > ----> 1 raise fail() > > /home/peter/miniconda3/lib/python3.4/site-packages/_pytest/runner.py in > fail(msg, pytrace) > 466 """ > 467 __tracebackhide__ = True > --> 468 raise Failed(msg=msg, pytrace=pytrace) > 469 fail.Exception = Failed > 470 > > Failed: <Failed instance> > > What would be the best way to handle this? Should we add a 'Failed` to the > catch block? It seems like a bad idea to me to catch a Fail in a test and > then do something with it but maybe that's the same as catching the > AssertionError? > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/b0f9af51-f164-4be2-b56c-065da0e9e6b6%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6Le8r5N3st7v_FLn3YG6GqQJAYLpHjumudBtrU3d_qbvQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
