I've run into this same problem a few times in unittest. I'm hoping someone 
else has a better solution.

1. The test harness uses webtest.TestApp to mount the Pyramid application 
2. A route has a payload with an object that can not be rendered into json
3. The traceback looks like the item below.

The problem is call stack doesn't have any information about my app-code 
that generated the render/exception.  I can match it to a route, via the 
line in the test harness, but that's it.  Because I have no idea where the 
return/response happened in the route logic, I often spend a lot of time 
with pdb breakpoints in the route trying to figure out what line caused it 
- as the return value could have been generated in multiple spots.

Has anyone figured out a standard way of dealing with this type of 
situation?

----

Traceback (most recent call last):

  File 
"/Users/jvanasco/webserver/os-projects-mine/project/tests/test_pyramid_app.py", 
line 6402, in test_post_required_json

    res = self.testapp.get(

    ....

    lots of webob/pyramid/etc items in the stack

    ... 

  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyramid/renderers.py",
 
line 298, in default

    raise TypeError('%r is not JSON serializable' % (obj,))

TypeError: <project.model.objects.Object object at 0x10c6a34f0> is not JSON 
serializable


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/f11c3d71-a7f5-44c1-90eb-7600cb86cf73n%40googlegroups.com.

Reply via email to