Hi all,
I have developed a serialization class which is based on tg.url(). When
trying to unit-test it using nose, I get the following error:
======================================================================
ERROR:
tracim.tests.library.test_serializers.TestSerializers.test_serialize_Content_comment_THREAD
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/nose/case.py",
line 198, in runTest
self.test(*self.arg)
File
"/home/damien/proj/tracim-app/pod/tracim/tracim/tests/library/test_serializers.py",
line 117, in test_serialize_Content_comment_THREAD
res = Context(CTX.THREAD).toDict(obj)
File
"/home/damien/proj/tracim-app/pod/tracim/tracim/model/serializers.py", line
191, in toDict
result = self.toDictSpecific(serializableObject)
File
"/home/damien/proj/tracim-app/pod/tracim/tracim/model/serializers.py", line
205, in toDictSpecific
result = converter_function(serializableObject, self) # process the
object with the given serializer
File
"/home/damien/proj/tracim-app/pod/tracim/tracim/model/serializers.py", line
409, in serialize_node_for_page
'delete':
context.url('/workspaces/{wid}/folders/{fid}/{ctype}/{cid}/comments/{commentid}/put_delete'.format(wid
= item.workspace_id, fid=item.parent.parent_id, ctype=item.parent.type+'s',
cid=item.parent.content_id, commentid=item.content_id))
File
"/home/damien/proj/tracim-app/pod/tracim/tracim/model/serializers.py", line
142, in url
url = tg.url(base_url, params)
File
"/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/TurboGears2-2.3.4-py3.2.egg/tg/controllers/util.py",
line 84, in url
req = tg.request._current_obj()
File
"/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/TurboGears2-2.3.4-py3.2.egg/tg/request_local.py",
line 171, in _current_obj
return getattr(context, self.name)
File
"/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/TurboGears2-2.3.4-py3.2.egg/tg/support/objectproxy.py",
line 19, in __getattr__
return getattr(self._current_obj(), attr)
File
"/home/damien/proj/tracim-app/pod/tg2env/lib/python3.2/site-packages/TurboGears2-2.3.4-py3.2.egg/tg/support/registry.py",
line 69, in _current_obj
'thread' % self.____name__)
*nose.proxy.TypeError: No object (name: context) has been registered for
this thread*
Question is : how to use tg.url() in unit-tests (without to go through
http-like class).
Should I call load_app() ?
Thank's
Damien
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.