On Mon, Jul 7, 2008 at 2:10 PM, Jonathan Vanasco <[EMAIL PROTECTED]> wrote:
>
>
> On Jul 7, 4:53 pm, "Mike Orr" <[EMAIL PROTECTED]> wrote:
>> True.  I'm just saying if you can code to avoid 'g' and 'c' in your
>> lib routines, so much the better.  I have never found a use for 'g',
>> except in one case to put a structure of static data that's parsed on
>> app startup (or read from a cache pickle).
>
> That is *exactly* what I use g for -- stashing 'static' data ( the
> names and ids of 'options' that the database fkeys on .  example:
>
> query= "select * from _gender"
> for row in rows:
>   g.gender.id[ row.id ]= row.name
>   g.gender.name[ row.name ]= row.id
>
> i also have some other misc. config data -- like amazon s3 urls, etc
> - which are initialized on startup based out of config values.
>
> i'm a little less-than-enthusiastic by the built in testing with
> Pylons.  not having g,c,session is annoying.

You're not initializing the application completely and you're
wondering why it isn't working?  Don't you see the contradiction
there?

> i've also noticed that
> for every test it does a full app initialization - which means ( in my
> case ) querying the database for 50 tables worth of data.

Unit tests always do that: setUp creates a full test environment,
which is discarded after each test.  Generally that's considered a
good thing even if it's slow.  Python apps have been testing this way
since long before Pylons was created. If you have to read 50 tables
worth of data, it's more a case that you have an unusual application
structure than that Python's testing is screwed up.  You may have to
test this application by pre-reading the data at module level and
putting it in place.  (And if it's place is in pylons.g, maybe have
some lightweight g-initialization routine that copies the variables
from their test module locations.  There's a module_setup function
that may persist between tests, although I'm not sure.

-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to