On 13/02/2010 11:00, Robert Collins wrote:
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.

We could introspect all class attributes and find all the resources. We should use dir(...) rather than looking in the class __dict__ so that resources can be inherited.

However, it sounds like Guido isn't a fan of Test Resources *instead* of setUpClass / module because it doesn't offer a simple solution for the setUpModule use case and the API still needs to mature.

All the best,

Michael

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

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk


--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to