<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 13/02/2010 11:00, Robert Collins wrote:
<blockquote cite="mid:1266058806.3458.290.camel@lifeless-64" type="cite">
<pre wrap="">On Sat, 2010-02-13 at 10:42 +0000, Antoine Pitrou wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Robert Collins <robertc <at> robertcollins.net> writes:
</pre>
<blockquote type="cite">
<pre wrap="">
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.
</pre>
</blockquote>
<pre wrap="">
Why not take all resource_XXX attributes?
</pre>
</blockquote>
<pre wrap="">
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.
</pre>
</blockquote>
<br>
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. <br>
<br>
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.<br>
<br>
All the best,<br>
<br>
Michael<br>
<br>
<blockquote cite="mid:1266058806.3458.290.camel@lifeless-64" type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">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?
</pre>
</blockquote>
<pre wrap="">
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
</pre>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk">http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk</a>
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.ironpythoninaction.com/">http://www.ironpythoninaction.com/</a>
<a class="moz-txt-link-freetext" href="http://www.voidspace.org.uk/blog">http://www.voidspace.org.uk/blog</a>
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.
</pre>
</body>
</html>