team pylons--

we have some admin processes that run on top of pylons (share model,
ini, etc) but run outside of any request context. these processes make
use of the "g" app_globals var ("g" holds a ref to a memcache client).
in unit tests, when i try to access "g" outside the scope of a
request, i get an exception. so how do i register g with the test
thread? or is my whole premise backwards?

sample code:

**** test_welcome.py ****

from test_9_5.tests import *

from pylons import g

class TestWelcomeController(TestController):

    def test_index(self):

        response = self.app.get(url_for(controller='welcome'))

        g.test = 'hello'

*** nosetests exception print out ****


Traceback (most recent call last):
  File "C:\projects\adroll_aaron_sandbox\test_9_5\test_9_5\tests
\functional\test_welcome.py", line 11, in test_index
    g.test = 'hello'
  File "c:\python25\lib\site-packages\Paste-1.3-py2.5.egg\paste
\registry.py", line 128, in __setattr__
    setattr(self._current_obj(), attr, value)
  File "c:\python25\lib\site-packages\Paste-1.3-py2.5.egg\paste
\registry.py", line 179, in _current_obj
    'thread' % self.____name__)
TypeError: No object (name: G) has been registered for this thread

thanks,
ab


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
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