Opened 17 years ago

Closed 17 years ago

#3625 closed (fixed)

Test fixtures cause load_data to fail with Python 2.3

Reported by: ned.phillips@… Owned by: Adrian Holovaty
Component: Testing framework Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Database sync (sqlite) fails when trying to load initial data (in this case there is none). The error appears to stem from rsplit which is used in source:trunk/django/core/management.py and was introduced in [4659] with the test fixtures framework. I'm using the stock OS X Python (2.3.5) over here and I believe this function was introduced in 2.4.

Error:

Loading 'initial_data' fixtures...
Traceback (most recent call last):
  File "manage.py", line 11, in ?
    execute_manager(settings)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/core/management.py", line 1663, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/core/management.py", line 1562, in execute_from_command_line
    action_mapping[action](int(options.verbosity), options.interactive)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/core/management.py", line 590, in syncdb
    load_data(['initial_data'], verbosity=verbosity)
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/django/core/management.py", line 1358, in load_data
    fixture_name, format = fixture_label.rsplit('.', 1)
AttributeError: 'str' object has no attribute 'rsplit'

Attachments (1)

management-rsplit-python23.diff (744 bytes ) - added by Antti Kaihola 17 years ago.
work around rsplit

Download all attachments as: .zip

Change History (9)

comment:1 by Gary Wilson <gary.wilson@…>, 17 years ago

Triage Stage: UnreviewedAccepted

by Antti Kaihola, 17 years ago

work around rsplit

comment:2 by Antti Kaihola, 17 years ago

Has patch: set

I added a patch for this problem. I tested it just with a syncdb on a fairly complex database on Python 2.5, and also verified that my rsplit replacement works correctly at least for cases like "a", "a.b", "a.b.c" etc.

comment:3 by Simon G. <dev@…>, 17 years ago

Component: UncategorizedUnit test system
Owner: changed from Jacob to Adrian Holovaty
Triage Stage: AcceptedReady for checkin

comment:4 by Chris Heisel, 17 years ago

Any update on when this patch might get committed -- we're unfortunately stuck on RHEL 4.x and RH won't honor support contracts if you install Python 2.4, even in a sandbox/separate path?

comment:5 by Chris Beaven, 17 years ago

Hi Chris, you'd get a better response asking this question in the developer group.

comment:6 by Malcolm Tredinnick, 17 years ago

The patch as written did not pass all the tests under python 2.4. So I'm checking in a modified version that seems to do the right thing. Can somebody with ready access to python2.3 please check that this fixes the problem (in particular, all the tests should still pass). If it passes under 2.3, we can mark this as fixed.

comment:7 by Malcolm Tredinnick, 17 years ago

(In [4671]) Removed rsplit() usage for python2.3 compatibility. Refs #3625.

comment:8 by Malcolm Tredinnick, 17 years ago

Resolution: fixed
Status: newclosed

Apparently if you want something tested you have to do it yourself, despite all the people who were apparently affected by this. :-(

I built Python 2.3 and database wrappers and it seems the rsplit() problem is gone. Some tests still fail under python2.3, but I don't believe it's related to this bug.

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