﻿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
7847	[Cleanup] Unused imported modules in Django	Julien Phalip	Adrian Holovaty	"I've removed many import statements of modules that were not used, throughout Django (see patch attached). That won't necessarily improve performance but it's a good cleanup at least. I ran the full test suite several times. I do get some failures/errors but I don't think they're linked to the changes in the patch since I get the exact same errors from a clean check out. My test environment (based on Windows XP+MySQL) is probably not 100% reliable and there might also be some problems caused by the latest big changes in trunk. Just for the record, here is a sample of the failures/errors I get:

{{{
======================================================================
FAIL: Doctest: modeltests.delete.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""E:\Software\workspace\django\django\test\_doctest.py"", line 2180, in run
Test
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for modeltests.delete.models.__test__.API_TE
STS
  File ""E:\Software\workspace\django-clean\tests\modeltests\delete\models.py"", l
ine unknown line number, in API_TESTS

----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\modeltests\delete\models.py"", lin
e ?, in modeltests.delete.models.__test__.API_TESTS
Failed example:
    del D._meta._related_objects_cache
Exception raised:
    Traceback (most recent call last):
      File ""E:\Software\workspace\django\django\test\_doctest.py"", line 1267, in
 __run
        compileflags, 1) in test.globs
      File ""<doctest modeltests.delete.models.__test__.API_TESTS[17]>"", line 1,
in <module>
        del D._meta._related_objects_cache
    AttributeError: _related_objects_cache


======================================================================
FAIL: Doctest: regressiontests.string_lookup.models.__test__.API_TESTS
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""E:\Software\workspace\django\django\test\_doctest.py"", line 2180, in run
Test
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.string_lookup.models.__t
est__.API_TESTS
  File ""E:\Software\workspace\django-clean\tests\regressiontests\string_lookup\m
odels.py"", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\string_lookup\mod
els.py"", line ?, in regressiontests.string_lookup.models.__test__.API_TESTS
Failed example:
    Foo.objects.get(friend__contains=u'\xe7')
Exception raised:
    Traceback (most recent call last):
      File ""E:\Software\workspace\django\django\test\_doctest.py"", line 1267, in
 __run
        compileflags, 1) in test.globs
      File ""<doctest regressiontests.string_lookup.models.__test__.API_TESTS[18]
>"", line 1, in <module>
        Foo.objects.get(friend__contains=u'\xe7')
      File ""E:\Software\workspace\django\django\db\models\manager.py"", line 82,
in get
        return self.get_query_set().get(*args, **kwargs)
      File ""E:\Software\workspace\django\django\db\models\query.py"", line 302, i
n get
        % self.model._meta.object_name)
    DoesNotExist: Foo matching query does not exist.
----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\string_lookup\mod
els.py"", line ?, in regressiontests.string_lookup.models.__test__.API_TESTS
Failed example:
    Foo.objects.get(friend__contains='\xc3\xa7')
Exception raised:
    Traceback (most recent call last):
      File ""E:\Software\workspace\django\django\test\_doctest.py"", line 1267, in
 __run
        compileflags, 1) in test.globs
      File ""<doctest regressiontests.string_lookup.models.__test__.API_TESTS[19]
>"", line 1, in <module>
        Foo.objects.get(friend__contains='\xc3\xa7')
      File ""E:\Software\workspace\django\django\db\models\manager.py"", line 82,
in get
        return self.get_query_set().get(*args, **kwargs)
      File ""E:\Software\workspace\django\django\db\models\query.py"", line 302, i
n get
        % self.model._meta.object_name)
    DoesNotExist: Foo matching query does not exist.


======================================================================
FAIL: Doctest: regressiontests.model_inheritance_regress.models.__test__.API_TES
TS
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""E:\Software\workspace\django\django\test\_doctest.py"", line 2180, in run
Test
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.model_inheritance_regres
s.models.__test__.API_TESTS
  File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritan
ce_regress\models.py"", line unknown line number, in API_TESTS

----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritance
_regress\models.py"", line ?, in regressiontests.model_inheritance_regress.models
.__test__.API_TESTS
Failed example:
    [sorted(d.items()) for d in dicts]
Expected:
    [[('name', u""Guido's House of Pasta""), ('serves_hot_dogs', True)]]
Got:
    [[('name', u""Guido's House of Pasta""), ('serves_hot_dogs', 1)]]
----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritance
_regress\models.py"", line ?, in regressiontests.model_inheritance_regress.models
.__test__.API_TESTS
Failed example:
    [sorted(d.items()) for d in dicts]
Expected:
    [[('name', u""Guido's House of Pasta""), ('serves_gnocchi', True), ('serves_ho
t_dogs', True)]]
Got:
    [[('name', u""Guido's House of Pasta""), ('serves_gnocchi', 1), ('serves_hot_d
ogs', 1)]]
----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritance
_regress\models.py"", line ?, in regressiontests.model_inheritance_regress.models
.__test__.API_TESTS
Failed example:
    [sorted(d.items()) for d in dicts]
Expected:
    [[('name', u""Guido's All New House of Pasta""), ('serves_hot_dogs', False)]]
Got:
    [[('name', u""Guido's All New House of Pasta""), ('serves_hot_dogs', 0)]]
----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritance
_regress\models.py"", line ?, in regressiontests.model_inheritance_regress.models
.__test__.API_TESTS
Failed example:
    [sorted(d.items()) for d in dicts]
Expected:
    [[('name', u""Guido's All New House of Pasta""), ('serves_gnocchi', False), ('
serves_hot_dogs', False)]]
Got:
    [[('name', u""Guido's All New House of Pasta""), ('serves_gnocchi', 0), ('serv
es_hot_dogs', 0)]]
----------------------------------------------------------------------
File ""E:\Software\workspace\django-clean\tests\regressiontests\model_inheritance
_regress\models.py"", line ?, in regressiontests.model_inheritance_regress.models
.__test__.API_TESTS
Failed example:
    [sorted(d.items()) for d in dicts]
Expected:
    [[('name', u""Guido's All New House of Pasta""), ('serves_gnocchi', False), ('
serves_hot_dogs', False)]]
Got:
    [[('name', u""Guido's All New House of Pasta""), ('serves_gnocchi', 0), ('serv
es_hot_dogs', 0)]]


----------------------------------------------------------------------
Ran 406 tests in 3574.203s

FAILED (failures=5, errors=6)
}}}
"		closed	Uncategorized	dev		fixed	cleanup		Accepted	1	0	0	0	0	0
