Re: Interaction btw unittest.assertRaises and __getattr__. Bug?

2010-10-27 Thread Chris Torek
In article c38a5bb4-6087-453c-8873-f193927fd...@d8g2000yqf.googlegroups.com Inyeol inyeol@gmail.com wrote: [snippage below] import unittest class C(): def __getattr__(self, name): raise AttributeError class Test(unittest.TestCase): def test_getattr(self): c = C()

Interaction btw unittest.assertRaises and __getattr__. Bug?

2010-10-26 Thread Inyeol
Unittest assertRaises cannot handle exception raised inside __getattr__ method. Is it a bug? or am I missing something obvious? Here is a sample of this problem: - import unittest class C(): def simple_attr(self): raise

Re: Interaction btw unittest.assertRaises and __getattr__. Bug?

2010-10-26 Thread Benjamin Peterson
Inyeol inyeol.lee at gmail.com writes: or am I missing something obvious? The attribute access is evaluated before the call to assertRaises, so unittest never has a cache to cache it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Interaction btw unittest.assertRaises and __getattr__. Bug?

2010-10-26 Thread Chris Rebert
On Tue, Oct 26, 2010 at 7:51 PM, Benjamin Peterson benja...@python.org wrote: Inyeol inyeol.lee at gmail.com writes: or am I missing something obvious? The attribute access is evaluated before the call to assertRaises, so unittest never has a cache to cache it. or rather, chance to catch