Opened 8 years ago

Last modified 8 years ago

#26096 closed Bug

Django 1.9.1 sometimes fails to delete cloned testing postgres db — at Version 2

Reported by: Alex Krupp Owned by: nobody
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 (2)

comment:1 by Alex Krupp, 8 years ago

Description: modified (diff)

comment:2 by Alex Krupp, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top