On Fri, 2010-02-12 at 12:27 -0800, Guido van Rossum wrote: > On Fri, Feb 12, 2010 at 12:20 PM, <exar...@twistedmatrix.com> wrote: > > The idea is that you're declaring what the tests need in order to work. > > You're not explicitly defining the order in which things are set up and torn > > down. That is left up to another part of the library to determine. > > > > One such other part, OptimisingTestSuite, will look at *all* of your tests > > and find an order which involves the least redundant effort. > > So is there a way to associate a "cost" with a resource? I may have > one resource which is simply a /tmp subdirectory (very cheap) and > another that requires starting a database service (very expensive).
From the pydoc: :ivar setUpCost: The relative cost to construct a resource of this type. One good approach is to set this to the number of seconds it normally takes to set up the resource. :ivar tearDownCost: The relative cost to tear down a resource of this type. One good approach is to set this to the number of seconds it normally takes to tear down the resource. > > You might have something else that breaks up the test run across multiple > > processes and uses the resource declarations to run all tests requiring one > > thing in one process and all tests requiring another thing somewhere else. > > I admire the approach, though I am skeptical. We have a thing to split > up tests at Google which looks at past running times for tests to make > an informed opinion. Have you thought of that? I think thats a great way to do it; in fact doing the same thing to assign setup and teardown costs would be lovely; I should write some glue to do that automatically for people. -Rob
signature.asc
Description: This is a digitally signed message part
_______________________________________________ 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