Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26096 closed Bug (fixed)

Django 1.9.1 fails to delete an existing test database on PostgreSQL and MySQL

Reported by: Alex Krupp Owned by: Tim Graham
Component: Testing framework Version: 1.9
Severity: Normal Keywords: testing parallel
Cc: Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Alex Krupp)

I got this error running python manage.py test tests --parallel=2:

“Got an error cloning the test database: unorderable types: str() >= int()”

This continued happening when running the tests in parallel even when telling django to delete the existing db, but not when using --parallel=1.

The full traceback is:

Type 'yes' if you would like to try deleting the test database 'test_myapp_api', or 'no' to cancel: yes
Destroying old test database for alias 'default'...
Cloning test database for alias 'default'...
Got an error cloning the test database: unorderable types: str() >= int()
Traceback (most recent call last):
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
psycopg2.ProgrammingError: database "test_myapp_api_1" already exists
 
The above exception was the direct cause of the following exception:
 
Traceback (most recent call last):
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/postgresql/creation.py", line 29, in _clone_test_db
    qn(target_database_name), qn(source_database_name)))
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/utils.py", line 62, in execute
    return self.cursor.execute(sql)
django.db.utils.ProgrammingError: database "test_myapp_api_1" already exists
 
 
During handling of the above exception, another exception occurred:
 
Traceback (most recent call last):
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/postgresql/creation.py", line 36, in _clone_test_db
    self._get_database_display_str(target_database_name, verbosity),
  File "/home/vagrant/user/.pyenv/versions/myapp343/lib/python3.4/site-packages/django/db/backends/base/creation.py", line 140, in _get_database_display_str
    (" ('%s')" % database_name) if verbosity >= 2 else '',
TypeError: unorderable types: str() >= int()

My stack: Django 1.9.1, Postgres 9.4, ubuntu trusty-64

Change History (5)

comment:1 by Alex Krupp, 8 years ago

Description: modified (diff)

comment:2 by Alex Krupp, 8 years ago

Description: modified (diff)

comment:3 by Tim Graham, 8 years ago

Component: UncategorizedTesting framework
Owner: changed from nobody to Tim Graham
Status: newassigned
Summary: Django 1.9.1 sometimes fails to delete cloned testing postgres dbDjango 1.9.1 fails to delete an existing test database on PostgreSQL and MySQL
Triage Stage: UnreviewedReady for checkin

I forgot to backport abcdb237bb313d116ce2ac8e90f79f61429afc70 to the stable/1.9.x branch.

comment:4 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In f0da306:

[1.9.x] Fixed #26096, refs #25196 -- Fixed incorrect argument order in test database creation.

Backport of abcdb237bb313d116ce2ac8e90f79f61429afc70 from master

comment:5 by Tim Graham <timograham@…>, 8 years ago

In 073dd4ce:

Refs #26096 -- Forwardported 1.9.2 release note.

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