﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
4457	Using a custom test suite, django.test.TestCase-based tests either fail silently (DEBUG = True) or fail with a generic error message (DEBUG = False)	Chris Wagner <cw264701@…>	Russell Keith-Magee	"I made a custom test script since I wanted to have tests in more places than just {{{tests.py}}} and {{{models.py}}}.  In the script, I set up Django's ""stuff"" using
{{{
django.test.utils.setup_test_environment()
django.test.utils.create_test_db(verbosity=0, autoclobber=True)
}}}
just before auto-detecting and running all tests using the ''nose'' testing tool/framework.  Under this configuration, I noticed that my django.test.TestCase-based tests could fail, but there would be no indication of failure when running them.

I looked at Django's code, to see how it ran the same tests, and the only noticeable difference that I saw, was, Django's test runner would set the ""DEBUG"" setting to {{{False}}} before initializing the test environment.  I added that to my script, and now the result is slightly better, as I at least see some indication of failure, but the error message is a generic one (""TemplateDoesNotExist: 500.html"") so I cannot easily determine the reason for failure.

Here's an example traceback:
{{{
ERROR: test_downloading_release_as_zip (tests.TestStuff)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""/home/chris/projects/easyweaze-py/easyweaze/test/web-level-tests/tests.py"", line 160, in test_downloading_release_as_zip
    response = self.client.get(""/members/zip_release/%d"" % r.id)
  File ""/usr/local/lib/python2.5/site-packages/django/test/client.py"", line 203, in get
    return self.request(**r)
  File ""/usr/local/lib/python2.5/site-packages/django/test/client.py"", line 168, in request
    response = self.handler(environ)
  File ""/usr/local/lib/python2.5/site-packages/django/test/client.py"", line 38, in __call__
    response = self.get_response(request)
  File ""/usr/local/lib/python2.5/site-packages/django/core/handlers/base.py"", line 126, in get_response
    return callback(request, **param_dict)
  File ""/usr/local/lib/python2.5/site-packages/django/views/defaults.py"", line 88, in server_error
    t = loader.get_template(template_name) # You need to create a 500.html template.
  File ""/usr/local/lib/python2.5/site-packages/django/template/loader.py"", line 79, in get_template
    source, origin = find_template_source(template_name)
  File ""/usr/local/lib/python2.5/site-packages/django/template/loader.py"", line 72, in find_template_source
    raise TemplateDoesNotExist, name
TemplateDoesNotExist: 500.html
}}}

Let me know if you'd like to see my test script or anything.  Thanks for any input on this."		closed	Testing framework	dev		fixed			Accepted	0	0	0	0	0	0
