[TIP] cleanUp for unittest
olemis at gmail.com
Tue Apr 7 10:16:20 PDT 2009
On Tue, Apr 7, 2009 at 11:30 AM, Fred Drake <fdrake at gmail.com> wrote:
> On Tue, Apr 7, 2009 at 11:58 AM, Olemis Lang <olemis at gmail.com> wrote:
>>> This relies on Python's garbage collector implementation details (i.e.
>> That's th idea ;)
> This seems to make it very easy to create fragile fixtures
> unintentionally, since not all Python implementations share the same
> garbage collection semantics.
Maybe this is a good point here (I say maybe because I have only used
CPython so far ;)
>> - As I said, the semantics for resource proxies is that they control
>> access to the underlying resource as long as they are loaded in
>> memory. If you want to discard'em call (force?) GC .
>> - If you want to control shared access to your resources, then it is
>> very posible that you might want to use either GoF Singleton or
>> ParametricSingleton pattern to implement the proxy classes ( there is
>> actually an article in JOT about using ParametricSingleton to control
>> access to shared RMI registries ;)
> While this seems reasonable on the face of it, it really adds more
> complexity. This is the result of needing more code to properly
> manage the resource allocation than what's needed just to tear it
Anyway, IMHO ParametricSingleton is related to implementing access
control to the real resource ( if this is the way it should be done,
and not otherwise ;) and not only to resources, also to any other kind
of objects for which a single instance can | should be created
considering the values of some parameters (which is even close to
memoize construct ;). So it was just a comment beyond the specific
problem at hand. If anybody has a problem to solve, and that can |
should be solved using a specific pattern (e.g. PSing) but he/she
doesnt, well ok, but that's beyond the simple ( yet non-deterministic
& therefore limited ) code I wrote before.
> Add to that the loss of determinism, and there's no real win
> that I can see.
Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/
Se retira el BDFL ... ¿El fin de Python 3k?
More information about the testing-in-python