Opened 7 years ago

Closed 7 years ago

#28234 closed Bug (invalid)

SimpleSearchTest failures with postgresql

Reported by: André Ericson Owned by: nobody
Component: contrib.postgres 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

I'm having some trouble running SimpleSearchTest on postgresql 9.6.3. Works fine on 9.5.

# django/tests/test_postgresql.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'django_tests',
    },
    'other': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'django_tests_other',
    }
}

SECRET_KEY = "django_tests_secret_key"

# Use a fast hasher to speed up tests.
PASSWORD_HASHERS = [
    'django.contrib.auth.hashers.MD5PasswordHasher',
]
➜ tests git:(master) ✗ python runtests.py postgres_tests --settings tests.test_postgresql
Testing against Django installed in '/Users/aericson/projects/django/django' with up to 4 processes
Creating test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Cloning test database for alias 'default'...
Creating test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
Cloning test database for alias 'other'...
System check identified no issues (0 silenced).
.....................................................................................................................................x.........x...x.......x...............................................................................................................................FF.................................................................................
======================================================================
FAIL: test_non_exact_match (postgres_tests.test_search.SimpleSearchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 601, in run
    testMethod()
  File "/Users/aericson/projects/django/tests/postgres_tests/test_search.py", line 92, in test_non_exact_match
    self.assertSequenceEqual(searched, [self.verse2])
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 1001, in assertSequenceEqual
    self.fail(msg)
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 666, in fail
    raise self.failureException(msg)
AssertionError: Sequences differ: <QuerySet []> != [<Line: His head smashed in and his heart[115 chars] -->]

Second sequence contains 1 additional elements.
First extra element 0:
<Line: His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off,And his -->

- <QuerySet []>
+ [<Line: His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off,And his -->]

======================================================================
FAIL: test_search_two_terms (postgres_tests.test_search.SimpleSearchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 601, in run
    testMethod()
  File "/Users/aericson/projects/django/tests/postgres_tests/test_search.py", line 96, in test_search_two_terms
    self.assertSequenceEqual(searched, [self.verse2])
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 1001, in assertSequenceEqual
    self.fail(msg)
  File "/Users/aericson/.pyenv/versions/3.6.1/lib/python3.6/unittest/case.py", line 666, in fail
    raise self.failureException(msg)
AssertionError: Sequences differ: <QuerySet []> != [<Line: His head smashed in and his heart[115 chars] -->]

Second sequence contains 1 additional elements.
First extra element 0:
<Line: His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off,And his -->

- <QuerySet []>
+ [<Line: His head smashed in and his heart cut out, And his liver removed and his bowels unplugged, And his nostrils ripped and his bottom burned off,And his -->]

----------------------------------------------------------------------
Ran 366 tests in 0.907s

FAILED (failures=2, expected failures=4)
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
Destroying test database for alias 'other'...
➜  tests git:(master) ✗

Please let me know if I can provide some more info.
I noticed Jenkins runs on 9.5, so I don't know if this problem is just for me or everybody.

Thanks.

Change History (3)

comment:1 by Tim Graham, 7 years ago

Component: Uncategorizedcontrib.postgres

Tests are passing on PostgreSQL 9.6.3 for me (Ubuntu 14.04).

comment:2 by Florian Apolloner, 7 years ago

Might be related to the current locale settings of the db?

comment:3 by André Ericson, 7 years ago

Resolution: invalid
Status: newclosed

It does seem to be a locale problem.

Cleaned up everything (removed /usr/local/var/postgres), installed postgres again with export LC_ALL=en_US.UTF-8; export LANG=en_US.UTF-8 and it worked.

Thanks guys.

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