Opened 7 years ago

Closed 7 years ago

#26414 closed Bug (duplicate)

postgres_test fail with psycopg2==2.4.5

Reported by: a-sh Owned by:
Component: contrib.postgres Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

$ pip freeze |grep psycopg2
psycopg2==2.4.5

$ PYTHONPATH=..:$PYTHONPATH ./runtests.py postgres_tests
Traceback (most recent call last):
  File "./runtests.py", line 458, in <module>
    options.debug_sql, options.parallel)
  File "./runtests.py", line 275, in django_tests
    extra_tests=extra_tests,
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/test/runner.py", line 532, in run_tests
    old_config = self.setup_databases()
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/test/runner.py", line 482, in setup_databases
    self.parallel, **kwargs
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/test/runner.py", line 726, in setup_databases
    serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/backends/base/creation.py", line 78, in create_test_db
    self.connection._test_serialized_contents = self.serialize_db_to_string()
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/backends/base/creation.py", line 122, in serialize_db_to_string
    serializers.serialize("json", get_objects(), indent=None, stream=out)
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/core/serializers/__init__.py", line 129, in serialize
    s.serialize(queryset, **options)
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/core/serializers/base.py", line 79, in serialize
    for count, obj in enumerate(queryset, start=1):
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/backends/base/creation.py", line 118, in get_objects
    for obj in queryset.iterator():
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/models/query.py", line 52, in __iter__
    results = compiler.execute_sql()
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/models/sql/compiler.py", line 848, in execute_sql
    cursor.execute(sql, params)
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: column postgres_tests_integerarraymodel.field does not exist
LINE 1: SELECT "postgres_tests_integerarraymodel"."id", "postgres_te...
                                                        ^

Try import ArrayField

$ python -c 'from django.contrib.postgres.fields import ArrayField'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/contrib/postgres/fields/array.py", line 4, in <module>
    from django.contrib.postgres.forms import SimpleArrayField
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/contrib/postgres/forms/__init__.py", line 4, in <module>
    from .ranges import *  # NOQA
  File "/home/user/dev/env/django-1.9.3/local/lib/python2.7/site-packages/Django-1.9.3-py2.7.egg/django/contrib/postgres/forms/ranges.py", line 1, in <module>
    from psycopg2.extras import DateRange, DateTimeTZRange, NumericRange
ImportError: cannot import name DateRange
[1]    6784 exit 1     python -c 'from django.contrib.postgres.fields import ArrayField'

then I check newer verision of psycopg2

$ pip install psycopg2==2.5.1
$ python -c 'from django.contrib.postgres.fields import ArrayField'

$ pip install psycopg2==2.6.1
$ python -c 'from django.contrib.postgres.fields import ArrayField'

tests would pass

Attachments (2)

django-1.9.3__psycopg2-2.4.5__runtests_output.txt (3.3 KB) - added by a-sh 7 years ago.
django-1.9.3__psycopg2-2.5.1__runtests_output.txt (1.4 KB) - added by a-sh 7 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 Changed 7 years ago by a-sh

Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top