Opened 16 years ago

Closed 16 years ago

#8029 closed (fixed)

admin_scripts regression tests override PYTHONPATH

Reported by: Ramiro Morales Owned by: nobody
Component: Testing framework Version: dev
Severity: Keywords: DATABASE_BACKEND admin_scripts
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Attachments (1)

admin_scripts.diff (599 bytes ) - added by Ramiro Morales 16 years ago.

Download all attachments as: .zip

Change History (3)

by Ramiro Morales, 16 years ago

Attachment: admin_scripts.diff added

comment:1 by Ramiro Morales, 16 years ago

Has patch: set

comment:2 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [8149]) Fixed #8029 -- Modified admin_scripts test to use the PYTHONPATH from the environment where the test is executed. Thanks to Ramiro and Alex Gaynor for the report.

Note: See TracTickets for help on using tickets.
Back to Top