Django tests failing under Python 2.3

30 views
Skip to first unread message

Andrew Durdin

unread,
Jan 28, 2007, 8:04:49 AM1/28/07
to Django developers
I'm trying to run all the django tests under Python 2.3.5 (on OS X
10.4.8), and there are lots of failures (see below).
My settings file for the test is just:

DEBUG = True

DATABASE_ENGINE = 'mysql' # 'postgresql', 'mysql', 'sqlite3'
or 'ado_mssql'.
DATABASE_NAME = 'test' # Or path to database file if using
sqlite3.
DATABASE_USER = 'root' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

ROOT_URLCONF = None


Do these indicate something screwy with my setup, or do other 2.3.5
users also get these?

here's the test command and the full output:

DJANGO_SETTINGS_MODULE=test_django.settings PYTHONPATH=~/django-
trunk:~/test_django ./tests/runtests.py

======================================================================
ERROR: Request a page that is protected with @login, but use bad
credentials
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 101, in test_view_with_bad_login
self.assertFalse(response)
AttributeError: 'ClientTest' object has no attribute 'assertFalse'

======================================================================
ERROR: Doctest: regressiontests.forms.tests
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/django/test/doctest.py",
line 2150, in runTest
failures, tries = runner.run(
File "/Users/andy/Projects/django-trunk/django/test/doctest.py",
line 1379, in run
return self.__run(test, compileflags, out)
File "/Users/andy/Projects/django-trunk/django/test/doctest.py",
line 1267, in __run
got += _exception_traceback(exc_info)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position
254: ordinal not in range(128)

======================================================================
FAIL: POST an empty dictionary to a view
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 53, in test_empty_post
self.assertEqual(response.status_code, 200)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 200

======================================================================
FAIL: GET a view that normally expects POSTs
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 45, in test_get_post_view
self.assertEqual(response.status_code, 200)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 200

======================================================================
FAIL: GET a view
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 35, in test_get_view
self.assertEqual(response.status_code, 200)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 200

======================================================================
FAIL: POST some data to a view
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 64, in test_post_view
self.assertEqual(response.status_code, 200)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 200

======================================================================
FAIL: GET a URL that redirects elsewhere
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 74, in test_redirect
self.assertEqual(response.status_code, 302)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 302

======================================================================
FAIL: GET an invalid URL
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 81, in test_unknown_page
self.assertEqual(response.status_code, 404)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 404

======================================================================
FAIL: Request a page that is protected with @login_required
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/andy/Projects/django-trunk/tests/modeltests/test_client/
models.py", line 88, in test_view_with_login
self.assertEqual(response.status_code, 302)
File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: 500 != 302

----------------------------------------------------------------------
Ran 68 tests in 6.718s

FAILED (failures=7, errors=2)

Robert Myers

unread,
Jan 29, 2007, 11:15:47 AM1/29/07
to django-d...@googlegroups.com

I'm seeing the same amount of errors on python 2.3.4, it appears the @ decorator syntax is being used in the modeltests/test-client/views.py. This was introduced in python 2.4, I changed it to the old decorator syntax 'blah = decorator(blah)' and still recieved 3 errors. So I haven't tried any further.

Robert
 

Jacob Kaplan-Moss

unread,
Jan 29, 2007, 11:50:03 AM1/29/07
to django-d...@googlegroups.com
On 1/29/07 10:15 AM, Robert Myers wrote:
> I'm seeing the same amount of errors on python 2.3.4, it appears the @
> decorator syntax is being used in the modeltests/test-client/views.py. This
> was introduced in python 2.4, I changed it to the old decorator syntax 'blah
> = decorator(blah)' and still recieved 3 errors. So I haven't tried any
> further.

I've fixed the decorator usage in [4451] -- thanks for the heads up.

Jacob

Andrew Durdin

unread,
Jan 29, 2007, 2:00:27 PM1/29/07
to Django developers
On Jan 29, 4:50 pm, Jacob Kaplan-Moss <j...@jacobian.org> wrote:
> On 1/29/07 10:15 AM, Robert Myers wrote:
>
> > I'm seeing the same amount of errors on python 2.3.4, it appears the @
> > decorator syntax is being used in the modeltests/test-client/views.py.

And I was so used to decorators that I didn't even pick up on that!

A couple of tests use assertFalse / assertTrue which were introduced
to unittest in 2.4 also; these should be changed to failIf /
failUnless respectively.

I couldn't figure out why one widget's test was giving a
UnicodeDecodeError while other extremely similar tests weren't...

Robert Myers

unread,
Jan 29, 2007, 5:24:29 PM1/29/07
to django-d...@googlegroups.com


I have created a ticket for this error with a patch for assertFalse and assertTrue as you noted.

http://code.djangoproject.com/ticket/3396

I'm still getting one error

 ======================================================================
FAIL: POST an empty dictionary to a view
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/www/local/django/tests/modeltests/test_client/models.py", line 53, in test_empty_post
    self.assertEqual(response.status_code, 200)
  File "/usr/lib/python2.3/unittest.py", line 302, in failUnlessEqual
Reply all
Reply to author
Forward
0 new messages