assertraises behaviour

andrea crotti andrea.crotti.0 at gmail.com
Tue Jul 17 11:06:36 CEST 2012


2012/7/16 Peter Otten <__peter__ at 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..



More information about the Python-list mailing list