On Sat, Jun 21, 2008 at 6:30 AM, Luke Plant <[EMAIL PROTECTED]> wrote: > Hi all,
Hi Luke - Great to see you back and committing again! :-) > Currently the tests pass, but they shouldn't -- the DELETE statement > should produce an IntegrityError or OperationalError (or, if 'ON > DELETE CASCADE' was set then the subsequent queries should return > nothing). If I try similar things outside the test harness, I get > the exceptions I expect. > > I'm testing this using a Postgres database, I've also tested with > sqlite and get the same thing, I haven't tested with MySQL. I get the same result. The SQLite failure isn't surprising - SQLite doesn't have row referential integrity. Neither does MySQL (using MyISAM tables), so the test passes under MySQL. (well... SQLite and MySQL actually both fail the test, but only because of the expected output - the deletion itself works fine). However, I can explain the behaviour. You're missing two important lines: >>> from django.db import transaction >>> transaction.commit() When you commit the transaction, you get the integrity error you expect. This isn't specific to the test system either - it's an artefact of getting a manual cursor. You get the same result when you use a python shell (from ./manage.py shell). Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---
