开发者

Django tests fail on Postgresql (8.4) - Flushing DB causes error

I'm dealing with a very annoying problem when trying to run DJ tests for a project on PostgreSQL backend. It starts running the tests and when the first DB flush should happen it fails with a strange error:

..Error: Datab开发者_StackOverflowase dbname couldn't be flushed. Possible reasons:
  * The database isn't running or isn't configured correctly.
  * At least one of the expected database tables doesn't exist.
  * The SQL was invalid.
Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run.
The full error: cannot TRUNCATE "table_name" because it has pending trigger events

If I run the output of sqlflush through pgAdmin, it runs just fine.

Any ideas are welcome for possible causes.

Update:

OK, looks like this is not actually a problem from Django, instead it's related to the test runner from djangosanetesting. With default DJ test runner or django-nose test runner it works.


OK, looks like this is not actually a problem from Django, instead it's related to the test runner from djangosanetesting, for which flushing seems to be broken in some way. For now I don't have a better solution than just using django-nose test runner.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜