On Sat, 2010-02-13 at 10:42 +0000, Antoine Pitrou wrote:
Robert Collins <robertc <at> robertcollins.net> writes:
I'm not personally very keen on inspecting everything in self.__dict__, I suspect it would tickle bugs in other unittest extensions. However I'm not really /against/ it - I don't think it will result in bad test behaviour or isolation issues. So if users would like it, lets do it.
Why not take all resource_XXX attributes?
Sure, though if we're just introspecting I don't see much risk difference between resource_XXX and all XXX. As I say above I'm happy to do it if folk think it will be nice.
By the way, how does a given test access the allocated resource? Say, the DB connection. Does it become an attribute of the test case instance?
yes. Given class Foo(TestCase): resources = {'thing', MyResourceManager()} def test_foo(self): self.thing self.thing will access the resource returned by MyResourceManager.make() -Rob