Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25475

Re: assertraises behaviour

References (1 earlier) <ju16g6$8o2$1@dough.gmane.org> <CAF_E5JZNrusmb2SziNBOah67ioZG0yf_w5RNJxVVrU8B5Tqzuw@mail.gmail.com> <ju1att$hc4$1@dough.gmane.org> <CAF_E5Ja4kzHGa9vEr5CML5wV7ampCULRRGt=9JtRoqn4Xxummw@mail.gmail.com> <ju1iug$mtd$1@dough.gmane.org>
Date 2012-07-17 10:06 +0100
Subject Re: assertraises behaviour
From andrea crotti <andrea.crotti.0@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2206.1342515998.4697.python-list@python.org> (permalink)

Show all headers | View raw


2012/7/16 Peter Otten <__peter__@web.de>:
> No, I don't see how the code you gave above can fail with an OSError.
>
> Can you give an example that produces the desired behaviour with nose? Maybe
> we can help you translate it to basic unittest.
>
> --
> http://mail.python.org/mailman/listinfo/python-list


Well this is what I meant:

import unittest

class TestWithRaises(unittest.TestCase):
    def test_first(self):
        assert False

    def test_second(self):
        print("also called")
        assert True

if __name__ == '__main__':
    unittest.main()

in this case also the second test is run even if the first fails..
But that's probably easy because we just need to catch exceptions for
every method call, so it's not exactly the same thing..

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: assertraises behaviour andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-17 10:06 +0100
  Re: assertraises behaviour Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2012-07-17 12:34 +0200
    RE: assertraises behaviour "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-17 17:49 +0000
    Re: assertraises behaviour Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-07-17 19:03 +0100
    RE: assertraises behaviour "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-07-17 21:04 +0000

csiph-web