Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17611 closed Bug (invalid)

django.contrib.gis raises exception on ./manage.py test

Reported by: andrey@… Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

from django.test.simple import run_tests as base_run_tests
ImportError: cannot import name run_tests

[15:32:04]: [Step 2/2] Starting: /opt/TeamCity/buildAgent/temp/agentTmp/custom_script7587252072882195123
[15:32:04]: [Step 2/2] in directory: /opt/TeamCity/buildAgent/work/a2bf5278fd80ad01
[15:32:05]: [Step 2/2] Traceback (most recent call last):
[15:32:05]: [Step 2/2]   File "./manage.py", line 11, in <module>
[15:32:05]: [Step 2/2]     execute_manager(settings)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/__init__.py", line 435, in execute_manager
[15:32:05]: [Step 2/2]     utility.execute()
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/__init__.py", line 358, in execute
[15:32:05]: [Step 2/2]     self.fetch_command(subcommand).run_from_argv(self.argv)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/commands/test.py", line 49, in run_from_argv
[15:32:05]: [Step 2/2]     super(Command, self).run_from_argv(argv)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/base.py", line 196, in run_from_argv
[15:32:05]: [Step 2/2]     self.execute(*args, **options.__dict__)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/base.py", line 232, in execute
[15:32:05]: [Step 2/2]     output = self.handle(*args, **options)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/local/lib/python2.7/site-packages/south/management/commands/test.py", line 8, in handle
[15:32:05]: [Step 2/2]     super(Command, self).handle(*args, **kwargs)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/core/management/commands/test.py", line 71, in handle
[15:32:05]: [Step 2/2]     test_runner = TestRunner(**options)
[15:32:05]: [Step 2/2]   File "/tmp/visamap-tc-virtualenv/src/django/django/contrib/gis/tests/__init__.py", line 6, in run_tests
[15:32:05]: [Step 2/2]     from django.test.simple import run_tests as base_run_tests
[15:32:05]: [Step 2/2] ImportError: cannot import name run_tests
[15:32:05]: [Step 2/2] Process exited with code 1
[15:32:06]: [Step 2/2] Step Command Line failed

Change History (4)

comment:1 by anonymous, 13 years ago

Resolution: invalid
Status: newclosed

it was my fail. Can you throw exception with instructions how to change user's settings.py?

comment:2 by anonymous, 13 years ago

Resolution: invalid
Status: closedreopened

comment:3 by Anssi Kääriäinen, 13 years ago

Resolution: invalid
Status: reopenedclosed

I am going to close this ticket, as it seems this should be invalid (as said in comment:1). I don't know why this was then reopened, a bit confusing... So if I am mistaken, please reopen.

comment:4 by geoffhing@…, 13 years ago

I ran into this issue when switching from Django 1.3.1 to 1.4.0

I wanted to add this comment to clarify the reason for getting the exception and my fix.

The exception is thrown because I had set the test runner to the GeoDjango like this:

TEST_RUNNER='django.contrib.gis.tests.run_tests'

According to the Testing GeoDjango Apps documentation:

In Django 1.2, the addition of Spatial Backends simplified the process of testing GeoDjango applications. The process is now the same as Testing Django applications.

So, specifying the GeoDjango test runner is no longer required and now seems to break things.

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