﻿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
8029	admin_scripts regression tests override PYTHONPATH	Ramiro Morales	nobody	"When running the test suite against a custom external DB backend, the admin_scripts test fail with multiple errors like this:

{{{
======================================================================
FAIL: multiple: manage.py builtin commands succeed if settings are provided as argument
----------------------------------------------------------------------
Traceback (most recent call last):
  File ""C:\ramiro\django-ramiro\tests\regressiontests\admin_scripts\tests.py"", line 669, in test_builtin_with_settings
    self.assertNoOutput(err)
  File ""C:\ramiro\django-ramiro\tests\regressiontests\admin_scripts\tests.py"", line 109, in assertNoOutput
    self.assertEquals(len(stream), 0, ""Stream should be empty: actually contains '%s'"" % stream)
AssertionError: Stream should be empty: actually contains 'Traceback (most recent call last):
  File ""./manage.py"", line 11, in <module>
    execute_manager(settings)
  File ""C:\ramiro\django-ramiro\django\core\management\__init__.py"", line 301, in execute_manager
    utility.execute()
  File ""C:\ramiro\django-ramiro\django\core\management\__init__.py"", line 248, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File ""C:\ramiro\django-ramiro\django\core\management\base.py"", line 77, in run_from_argv
    self.execute(*args, **options.__dict__)
  File ""C:\ramiro\django-ramiro\django\core\management\base.py"", line 90, in execute
    self.validate()
  File ""C:\ramiro\django-ramiro\django\core\management\base.py"", line 117, in validate
    num_errors = get_validation_errors(s, app)
  File ""C:\ramiro\django-ramiro\django\core\management\validation.py"", line 22, in get_validation_errors
    from django.db import models, connection
  File ""C:\ramiro\django-ramiro\django\db\__init__.py"", line 34, in <module>
    (settings.DATABASE_ENGINE, "", "".join(map(repr, available_backends)))
django.core.exceptions.ImproperlyConfigured: 'sql_server.pyodbc' isn't an available database backend.
Available options are: 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'

----------------------------------------------------------------------
Ran 93 tests in 32.563s

FAILED (failures=25)
}}}

Suspicion is that the tests override the {{{PYTHONPATH}}} envvar, and this break things ebcause the documented way of specifying an external backend is adding it's path to {{{PYTHONPATH}}} and setting the {{{DATABASE_ENGINE}}} var of the {{{settings}}} file being used for testing.

It was confirmed by Alex Gaynor who suggested to try the patch attached that solved the problem.
"		closed	Testing framework	dev		fixed	DATABASE_BACKEND admin_scripts		Unreviewed	1	0	0	0	0	0
