﻿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
19833	Django's test framework fails when using unicode strings in settings.py	Danilo Bargen	nobody	"When specifying a non-standard test runner using an unicode string in settings.py (`TEST_RUNNER = u'disccover_runner.DiscoverRunner'`) or when using `from __future__ import unicode_literals`, the `test` management command breaks.

This is the ""faulty"" code snippet (`test/utils.py`):

{{{#!python
def get_runner(settings, test_runner_class=None):                                                   
    if not test_runner_class:                                                                       
        test_runner_class = settings.TEST_RUNNER                                                    
                                                                                                    
    test_path = test_runner_class.split('.')                                                        
    # Allow for Python 2.5 relative paths                                                           
    if len(test_path) > 1:                                                                          
        test_module_name = '.'.join(test_path[:-1])                                                 
    else:                                                                                           
        test_module_name = '.'                                                                      
    test_module = __import__(test_module_name, {}, {}, test_path[-1])                                                                                 
    test_runner = getattr(test_module, test_path[-1])                                               
    return test_runner                                                                              
}}}

The problem is that a unicode string gets passed to `__import__`s `fromlist` argument. Apparently that won't work.

I'm not sure what the right solution is. Is it enough to just convert `test_path[-1]` to a `str` type? Are decoding errors possible in that case? Are there any helper functions in Django to do a conversion that works both in py2 and py3 (str() vs bytes())?

Bug tested on 1.4 and 1.5."	Bug	closed	Testing framework	1.4	Release blocker	fixed	unicode, test runner, py3k		Accepted	0	0	0	0	1	0
