#2879: Add live test server support to test framework -------------------------------------+------------------------------------- Reporter: Mikeal Rogers | Owner: devin <mikeal@…> | Status: new Type: New feature | Version: Component: Testing framework | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): Re the above transaction handling: it seems that when running the test_methods, you are not running in a managed transaction state. So, all saves will be committed immediately. Thus, the above might not be such a big problem after all. While testing this patch, I got this error: {{{ Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner self.run() File "/home/akaj/Django/django_test/django/test/testcases.py", line 861, in run handler = StaticFilesHandler(MediaFilesHandler(WSGIHandler())) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 21, in __init__ self.base_url = urlparse(self.get_base_url()) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 28, in get_base_url utils.check_settings() File "/home/akaj/Django/django_test/django/contrib/staticfiles/utils.py", line 49, in check_settings "You're using the staticfiles app " ImproperlyConfigured: You're using the staticfiles app without having set the required STATIC_URL setting. }}} The test_runner just hang. ctrl-C does nothing. So 1) it seems the `StaticFilesHandler` needs STATIC_URL. 2) If you get an error in the setup of the live-server, the thread will not go away. I took a quick glance, and can't see why it doesn't go away. And 3) the live-server thread should be daemonic to minimize the potential for process-hangs. I also got this printout for a simple test (one get request, test one element present). {{{ python manage.py test --settings=settings obj_creation_speed Creating test database for alias 'default'... Traceback (most recent call last): File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run self.result = application(self.environ, self.start_response) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 67, in __call__ return self.application(environ, start_response) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 68, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) File "/home/akaj/Django/django_test/django/core/handlers/wsgi.py", line 242, in __call__ response = self.get_response(request) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 63, in get_response return super(StaticFilesHandler, self).get_response(request) File "/home/akaj/Django/django_test/django/core/handlers/base.py", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/akaj/Django/django_test/django/core/handlers/base.py", line 228, in handle_uncaught_exception return callback(request, **param_dict) File "/home/akaj/Django/django_test/django/utils/decorators.py", line 91, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/akaj/Django/django_test/django/views/defaults.py", line 32, in server_error t = loader.get_template(template_name) # You need to create a 500.html template. File "/home/akaj/Django/django_test/django/template/loader.py", line 145, in get_template template, origin = find_template(template_name) File "/home/akaj/Django/django_test/django/template/loader.py", line 138, in find_template raise TemplateDoesNotExist(name) TemplateDoesNotExist: 500.html Traceback (most recent call last): File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run self.result = application(self.environ, self.start_response) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 67, in __call__ return self.application(environ, start_response) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 68, in __call__ return super(StaticFilesHandler, self).__call__(environ, start_response) File "/home/akaj/Django/django_test/django/core/handlers/wsgi.py", line 242, in __call__ response = self.get_response(request) File "/home/akaj/Django/django_test/django/contrib/staticfiles/handlers.py", line 63, in get_response return super(StaticFilesHandler, self).get_response(request) File "/home/akaj/Django/django_test/django/core/handlers/base.py", line 153, in get_response response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) File "/home/akaj/Django/django_test/django/core/handlers/base.py", line 228, in handle_uncaught_exception return callback(request, **param_dict) File "/home/akaj/Django/django_test/django/utils/decorators.py", line 91, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/akaj/Django/django_test/django/views/defaults.py", line 32, in server_error t = loader.get_template(template_name) # You need to create a 500.html template. File "/home/akaj/Django/django_test/django/template/loader.py", line 145, in get_template template, origin = find_template(template_name) File "/home/akaj/Django/django_test/django/template/loader.py", line 138, in find_template raise TemplateDoesNotExist(name) TemplateDoesNotExist: 500.html . ---------------------------------------------------------------------- Ran 1 test in 9.317s OK Destroying test database for alias 'default'... }}} So, I am getting a couple of 500.html not exists for a test which is (as far as I understand) doing just a single get. -- Ticket URL: <https://code.djangoproject.com/ticket/2879#comment:91> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.