Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#17611 closed Bug (invalid)

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

Reported by: andrey@… Owned by: nobody
Component: GIS Version: master
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 Changed 4 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

comment:2 Changed 4 years ago by anonymous

  • Resolution invalid deleted
  • Status changed from closed to reopened

comment:3 Changed 4 years ago by akaariai

  • Resolution set to invalid
  • Status changed from reopened to closed

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 Changed 3 years ago by geoffhing@…

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