Hi All,
I am trying to use TDD to develop an app using TG2.
The test is like this
def test_home_page_should_have_an_input_form_to_submit_message(self):
resp = self.app.get('/')
form = resp.form
form['message'] = 'Message to be sent.'
send_message = form.submit(status=302)
ok_(send_message.location.startswith('http://localhost/'))
result_page = send_message.follow()
ok_("Message sent" in result_page.text)
However, when I have error in RootController.index(), I just got server 500
like following
Traceback (most recent call last):
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/nose/case.py",
>
> line 198, in runTest
> self.test(*self.arg)
> File
> "/Users/edwinkcw/.pyenv/versions/3.3.2/lib/python3.3/unittest/mock.py",
> line 1087, in patched
> return func(*args, **keywargs)
> File
> "/Users/edwinkcw/Workspace/message-broadcaster/message-broadcaster/messagebroadcaster/tests/functional/test_root.py",
>
> line 28, in test_home_page_should_have_an_input_form_to_submit_message
> send_message = form.submit(status=302)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 1708, in submit
> params=fields, **args)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 369, in goto
> return method(href, **args)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 838, in post
> content_type=content_type)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 810, in _gen_request
> expect_errors=expect_errors)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 1121, in do_request
> self._check_status(status, res)
> File
> "/Users/edwinkcw/.virtualenvs/message-broadcaster/lib/python3.3/site-packages/webtest/app.py",
>
> line 1160, in _check_status
> "Bad response: %s (not %s)", res_status, status)
> nose.proxy.AppError: Bad response: 500 INTERNAL SERVER ERROR (not 302)
>
It is not quite useful for me to debug. I would like to have something like
sqlalchemy.exc.OperationalError with backtrace, which can tell me which
line causes the error occurs. Right now, I can only start the server and
simulate the test in browser to figure out what causes the server 500. How
can I get more useful information when running functional test?
Thanks
--
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.